Merge branch 'review' into develop
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8e1faf3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+GIT_EXEC_PATH=/usr/libexec/git-core
+
+all:
+ @echo "There is only one target here: install"
+ @echo "This message is deliberately inserted here to prevent accidental installation."
+ @echo ""
+ @echo "Use 'make install' explicitly to install git-flow."
+
+install:
+ install -m 0755 -t $(GIT_EXEC_PATH) git-flow
+ install -m 0644 -t $(GIT_EXEC_PATH) \
+ git-flow-feature \
+ git-flow-hotfix \
+ git-flow-release \
+ git-flow-support \
+ git-flow-version
+
diff --git a/TODO.mdown b/TODO.mdown
index 0bb08db..9516b0a 100644
--- a/TODO.mdown
+++ b/TODO.mdown
@@ -3,9 +3,6 @@
General configuration
---------------------
-- Support configurable naming for fixed branch names 'master' and 'develop'
-- Support configurable naming conventions (i.e. name prefixes) for supporting
- branches, instead of fixed 'release-\*' and 'hotfix-\*'
Release branch support
----------------------
diff --git a/git-flow b/git-flow
new file mode 100755
index 0000000..04868aa
--- /dev/null
+++ b/git-flow
@@ -0,0 +1,222 @@
+#!/bin/sh
+#
+# gitflow -- A collection of Git wrapper scripts to provide high-level
+# repository operations for Vincent Driessen's branching model:
+#
+# Original blog post presenting this model is found at:
+# http://nvie.com/archives/323
+#
+# Feel free to contribute to this project at:
+# http://github.com/nvie/gitflow
+#
+# Copyright (c) 2010 by Vincent Driessen
+# Copyright (c) 2010 by Benedikt Böhm
+#
+
+# enable debug mode
+if [ "$DEBUG" = "yes" ]; then
+ set -x
+fi
+
+export GITFLOW_DIR=$(dirname "$0")
+export MASTER_BRANCH=$(git config --get gitflow.branch.master || echo master)
+export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop || echo develop)
+export ORIGIN=$(git config --get gitflow.origin || echo origin)
+export README=$(git config --get gitflow.readme || echo README)
+
+warn() { echo "$@" >&2; }
+die() { warn "$@"; exit 1; }
+
+has() {
+ local item=$1; shift
+ echo " $@ " | grep -q " $item "
+}
+
+usage() {
+ . "$GITFLOW_DIR/git-flow-version"
+ echo "gitflow, version $GITFLOW_VERSION"
+ echo
+ echo "usage: git flow <cmd> <type> <args>"
+ echo " git flow init [<url>]"
+ echo
+ echo "<type> can be any of: feature, release, hotfix, support"
+ echo
+ echo "Try 'git flow help <type>' for details."
+}
+
+main() {
+ if [ $# -lt 1 ]; then
+ usage
+ exit 1
+ fi
+
+ # sanity checks
+ ACTION="$1"; shift
+
+ if [ "$ACTION" = "init" ]; then
+ gitflow_init "$@"
+ exit 0
+ fi
+
+ BTYPE="$1"; shift
+
+ if [ ! -e "$GITFLOW_DIR/git-flow-$BTYPE" ]; then
+ usage
+ exit 1
+ fi
+
+ if ! git rev-parse --git-dir &>/dev/null; then
+ die "Not a git repository"
+ fi
+
+ # get all available branches
+ LOCAL_BRANCHES=$(git branch | sed 's/^[* ] //')
+ REMOTE_BRANCHES=$(git branch -r | sed 's/^[* ] //')
+ ALL_BRANCHES="$LOCAL_BRANCHES $REMOTE_BRANCHES"
+
+ # run command
+ . "$GITFLOW_DIR/git-flow-$BTYPE"
+
+ if ! declare -f cmd_$ACTION >/dev/null; then
+ usage
+ exit 1
+ fi
+
+ # run command
+ cmd_$ACTION "$@"
+}
+
+gitflow_init() {
+ echo
+ echo "Summary of actions:"
+
+ if ! git rev-parse --git-dir &>/dev/null; then
+ git init --quiet
+ echo "- A new git repository at $PWD was created"
+ fi
+
+ if ! git rev-parse --quiet --verify HEAD >/dev/null; then
+ touch $README
+ git add $README
+ git commit --quiet -m "initial commit"
+ if [ "$MASTER_BRANCH" != "master" ]; then
+ git branch -m master $MASTER_BRANCH
+ fi
+ echo "- An initial commit was created at branch '$MASTER_BRANCH'"
+ fi
+
+ if ! git rev-parse --verify $MASTER_BRANCH &>/dev/null; then
+ die "Cannot find your master branch. Try: git branch -m <mymaster> $MASTER_BRANCH"
+ fi
+
+ gitflow_check_clean_working_tree
+
+ if git remote | grep -q $ORIGIN; then
+ git fetch -q $ORIGIN
+ gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
+ fi
+
+ if git rev-parse --verify $DEVELOP_BRANCH &>/dev/null; then
+ gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
+ else
+ git checkout -q -b $DEVELOP_BRANCH $MASTER_BRANCH
+ echo "- A new branch '$DEVELOP_BRANCH' was created"
+ echo "- You are now on branch '$DEVELOP_BRANCH'"
+ fi
+
+ if ! git remote | grep -q $ORIGIN; then
+ if [ "$1" = "" ]; then
+ echo "- No remote location was added. Try: git remote add $ORIGIN <url>"
+ else
+ git remote add $ORIGIN $1
+ echo "- A new remote location '$1' was added"
+ fi
+ fi
+
+ echo
+
+ if git remote | grep -q $ORIGIN; then
+ git push $ORIGIN $MASTER_BRANCH $DEVELOP_BRANCH
+ fi
+}
+
+gitflow_check_clean_working_tree() {
+ if ! git diff --no-ext-diff --ignore-submodules --quiet --exit-code; then
+ die "Working tree contains unstaged changes. Aborting ..."
+ fi
+ if ! git diff-index --cached --quiet --ignore-submodules HEAD --; then
+ die "Index contains uncommited changes. Aborting ..."
+ fi
+}
+
+gitflow_require_local_branch() {
+ if ! has $1 $LOCAL_BRANCHES; then
+ die "Local branch '$1' does not exist and is required."
+ fi
+}
+
+gitflow_require_remote_branch() {
+ if ! has $1 $REMOTE_BRANCHES; then
+ die "Remote branch '$1' does not exist and is required."
+ fi
+}
+
+gitflow_require_branch() {
+ if ! has $1 $ALL_BRANCHES; then
+ die "Branch '$1' does not exist and is required."
+ fi
+}
+
+gitflow_require_branch_absent() {
+ if has $1 $ALL_BRANCHES; then
+ die "Branch '$1' already exists. Pick another name."
+ fi
+}
+
+#
+# gitflow_test_branches_equal()
+#
+# Tests whether branches and their "origin" counterparts have diverged and need
+# merging first. It returns error codes to provide more detail, like so:
+#
+# 0 Branch heads point to the same commit
+# 1 First given branch needs fast-forwarding
+# 2 Second given branch needs fast-forwarding
+# 3 Branch needs a real merge
+#
+gitflow_test_branches_equal() {
+ commit1=$(git rev-parse "$1")
+ commit2=$(git rev-parse "$2")
+ if [ "$commit1" != "$commit2" ]; then
+ base=$(git merge-base "$commit1" "$commit2")
+ if [ "$commit1" = "$base" ]; then
+ return 1
+ elif [ "$commit2" = "$base" ]; then
+ return 2
+ else
+ return 3
+ fi
+ else
+ return 0
+ fi
+}
+
+gitflow_require_branches_equal() {
+ gitflow_require_local_branch "$1"
+ gitflow_require_remote_branch "$2"
+ gitflow_test_branches_equal "$1" "$2"
+ status=$?
+ if [ $status -gt 0 ]; then
+ warn "Branches '$1' and '$2' have diverged."
+ if [ $status -eq 1 ]; then
+ die "And branch '$1' may be fast-forwarded."
+ elif [ $status -eq 2 ]; then
+ # Warn here, since there is no harm in being ahead
+ warn "And local branch '$1' is ahead of '$2'."
+ else
+ die "Branches need merging first."
+ fi
+ fi
+}
+
+main "$@"
diff --git a/git-flow-feature b/git-flow-feature
new file mode 100644
index 0000000..c4fd814
--- /dev/null
+++ b/git-flow-feature
@@ -0,0 +1,156 @@
+#
+# gitflow -- A collection of Git wrapper scripts to provide high-level
+# repository operations for Vincent Driessen's branching model:
+#
+# Original blog post presenting this model is found at:
+# http://nvie.com/archives/323
+#
+# Feel free to contribute to this project at:
+# http://github.com/nvie/gitflow
+#
+# Copyright (c) 2010 by Vincent Driessen
+# Copyright (c) 2010 by Benedikt Böhm
+#
+
+usage() {
+ echo "usage: git flow start feature <name> [<base>]"
+ echo " git flow finish feature <name> [<base>]"
+ echo " git flow publish feature <name>"
+ echo " git flow track feature <name>"
+ # TODO
+ #echo ""
+ #echo "options:"
+ #echo "--option Explanation"
+ #echo ""
+ #echo "start-only options:"
+ #echo "--option Explanation"
+ #echo ""
+ #echo "finish-only options:"
+ #echo "--rebase Rebases the feature branch on top of develop, instead of merging"
+ #echo "--squash Squashes all commits of the feature branch into a single commit"
+ #echo " on develop"
+ #echo "--push Push to the origin repo when finished"
+}
+
+parse_args() {
+ NAME="$1"
+ BASE="${2:-$DEVELOP_BRANCH}"
+ if [ "$NAME" = "" ]; then
+ echo "Missing argument <name>."
+ usage
+ exit 1
+ fi
+ PREFIX=$(git config --get gitflow.prefix.feature || echo feature/)
+ BRANCH=$PREFIX$NAME
+}
+
+cmd_help() {
+ usage
+ exit 0
+}
+
+cmd_start() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ gitflow_require_branch_absent $BRANCH
+ if [ "$BASE" = "$DEVELOP_BRANCH" ]; then
+ git fetch -q $ORIGIN $DEVELOP_BRANCH
+ gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
+ fi
+
+ # create branch
+ git checkout -b $BRANCH $BASE
+
+ echo
+ echo "Summary of actions:"
+ echo "- A new branch '$BRANCH' was created, based on '$BASE'"
+ echo "- You are now on branch '$BRANCH'"
+ echo ""
+ echo "Now, start committing on your feature. When done, use:"
+ echo ""
+ echo " git flow finish feature $NAME"
+ echo
+}
+
+cmd_finish() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ gitflow_require_branch $BRANCH
+ git fetch -q $ORIGIN
+ if has $ORIGIN/$BRANCH $REMOTE_BRANCHES; then
+ gitflow_require_branches_equal $BRANCH $ORIGIN/$BRANCH
+ fi
+ if [ "$BASE" = "$DEVELOP_BRANCH" ]; then
+ gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
+ fi
+
+ # merge into BASE
+ git checkout $BASE
+ if [ "$(git rev-list -n2 $BASE..$BRANCH | wc -l)" = "1" ]; then
+ git merge --ff $BRANCH
+ else
+ git merge --no-ff $BRANCH
+ fi
+
+ # delete branch
+ # TODO: How do we handle merge conflicts here??
+ git push $ORIGIN :refs/heads/$BRANCH
+ git branch -d $BRANCH
+
+ echo
+ echo "Summary of actions:"
+ echo "- The feature branch '$BRANCH' was merged into '$BASE'"
+ #echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
+ echo "- Feature branch '$BRANCH' has been removed"
+ echo "- You are now on branch '$BASE'"
+ echo
+}
+
+cmd_publish() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ gitflow_require_branch $BRANCH
+ git fetch -q $ORIGIN
+ gitflow_require_branch_absent $ORIGIN/$BRANCH
+
+ # create remote branch
+ git push $ORIGIN $BRANCH:refs/heads/$BRANCH
+ git fetch -q $ORIGIN
+
+ # configure remote tracking
+ git config branch.$BRANCH.remote $ORIGIN
+ git config branch.$BRANCH.merge refs/heads/$BRANCH
+ git checkout $BRANCH
+
+ echo
+ echo "Summary of actions:"
+ echo "- A new remote branch '$BRANCH' was created"
+ echo "- The local branch '$BRANCH' was configured to track the remote branch"
+ echo "- You are now on branch '$BRANCH'"
+ echo
+}
+
+cmd_track() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ gitflow_require_branch_absent $BRANCH
+ git fetch -q $ORIGIN
+ gitflow_require_branch $ORIGIN/$BRANCH
+
+ # create tracking branch
+ git checkout -b $BRANCH $ORIGIN/$BRANCH
+
+ echo
+ echo "Summary of actions:"
+ echo "- A new remote tracking branch '$BRANCH' was created"
+ echo "- You are now on branch '$BRANCH'"
+ echo
+}
diff --git a/git-flow-hotfix b/git-flow-hotfix
new file mode 100644
index 0000000..aea27cc
--- /dev/null
+++ b/git-flow-hotfix
@@ -0,0 +1,111 @@
+#
+# gitflow -- A collection of Git wrapper scripts to provide high-level
+# repository operations for Vincent Driessen's branching model:
+#
+# Original blog post presenting this model is found at:
+# http://nvie.com/archives/323
+#
+# Feel free to contribute to this project at:
+# http://github.com/nvie/gitflow
+#
+# Copyright (c) 2010 by Vincent Driessen
+# Copyright (c) 2010 by Benedikt Böhm
+#
+
+usage() {
+ echo "usage: git flow start hotfix <version> [<base>]"
+ echo " git flow finish hotfix <version> [<base>]"
+ # TODO
+ #echo ""
+ #echo "options:"
+ #echo "--option Explanation"
+ #echo ""
+ #echo "start-only options:"
+ #echo "--option Explanation"
+ #echo ""
+ #echo "finish-only options:"
+ #echo "--push Push to the origin repo when finished"
+}
+
+parse_args() {
+ VERSION="$1"
+ BASE="${2:-$MASTER_BRANCH}"
+ if [ "$VERSION" = "" ]; then
+ echo "Missing argument <version>."
+ usage
+ exit 1
+ fi
+ PREFIX=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
+ BRANCH=$PREFIX$VERSION
+}
+
+cmd_help() {
+ usage
+ exit 0
+}
+
+cmd_start() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ git fetch -q $ORIGIN
+ gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
+ gitflow_require_branch_absent $BRANCH
+
+ # create branch
+ git checkout -b $BRANCH $BASE
+
+ echo
+ echo "Summary of actions:"
+ echo "- A new branch '$BRANCH' was created, based on '$BASE'"
+ echo "- You are now on branch '$BRANCH'"
+ echo
+ echo "Follow-up actions:"
+ echo "- Bump the version number now!"
+ echo "- Start committing your hot fixes"
+ echo "- When done, run:"
+ echo
+ echo " git flow finish hotfix '$HOTFIX_BRANCH'"
+ echo
+}
+
+cmd_finish() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ git fetch -q $ORIGIN $MASTER_BRANCH
+ git fetch -q $ORIGIN $DEVELOP_BRANCH
+ gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
+ gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
+
+ # merge into BASE
+ git checkout $BASE
+ git merge --no-ff $BRANCH
+ git tag v$VERSION
+
+ # merge into develop if we fixed a master issue
+ # TODO: merge into support branch
+ if [ "$BASE" = "$MASTER_BRANCH" ]; then
+ git checkout $DEVELOP_BRANCH
+ git merge --no-ff $BRANCH
+ fi
+
+ # delete branch
+ git branch -d $BRANCH
+
+ # TODO: Implement an optional push to master
+ # git push origin develop; git push origin master; git push --tags origin
+
+ echo
+ echo "Summary of actions:"
+ echo "- Latest objects have been fetched from '$ORIGIN'"
+ echo "- Hotfix branch has been merged into '$BASE'"
+ echo "- The hotfix was tagged 'v$VERSION'"
+ if [ "$BASE" = "$MASTER_BRANCH" ]; then
+ echo "- Hotfix branch has been back-merged into '$DEVELOP_BRANCH'"
+ fi
+ echo "- Hotfix branch '$BRANCH' has been deleted"
+ echo
+}
diff --git a/git-flow-release b/git-flow-release
new file mode 100644
index 0000000..f71f753
--- /dev/null
+++ b/git-flow-release
@@ -0,0 +1,105 @@
+#
+# gitflow -- A collection of Git wrapper scripts to provide high-level
+# repository operations for Vincent Driessen's branching model:
+#
+# Original blog post presenting this model is found at:
+# http://nvie.com/archives/323
+#
+# Feel free to contribute to this project at:
+# http://github.com/nvie/gitflow
+#
+# Copyright (c) 2010 by Vincent Driessen
+# Copyright (c) 2010 by Benedikt Böhm
+#
+
+usage() {
+ echo "usage: git flow start release <version>"
+ echo " git flow finish release <version>"
+ # TODO
+ #echo ""
+ #echo "options:"
+ #echo "--option Explanation"
+ #echo ""
+ #echo "start-only options:"
+ #echo "--bump <script>"
+ #echo " Run the given script to auto-update the version number"
+ #echo ""
+ #echo "finish-only options:"
+ #echo "--push Push to the origin repo when finished"
+}
+
+parse_args() {
+ VERSION="$1"
+ if [ "$VERSION" = "" ]; then
+ echo "Missing argument <version>."
+ usage
+ exit 1
+ fi
+ PREFIX=$(git config --get gitflow.prefix.release || echo release/)
+ BRANCH=$PREFIX$VERSION
+}
+
+cmd_help() {
+ usage
+ exit 0
+}
+
+cmd_start() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ git fetch -q $ORIGIN
+ gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
+ gitflow_require_branch_absent $BRANCH
+
+ # create branch
+ git checkout -b $BRANCH $DEVELOP_BRANCH
+
+ echo
+ echo "Summary of actions:"
+ echo "- A new branch '$BRANCH' was created, based on '$DEVELOP_BRANCH'"
+ echo "- You are now on branch '$BRANCH'"
+ echo
+ echo "Follow-up actions:"
+ echo "- Bump the version number now!"
+ echo "- Start committing last-minute fixes in preparing your release"
+ echo "- When done, run:"
+ echo
+ echo " git flow finish release '$VERSION'"
+ echo
+}
+
+cmd_finish() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+ git fetch -q $ORIGIN
+ gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
+ gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
+
+ # merge into master
+ git checkout $MASTER_BRANCH
+ git merge --no-ff $BRANCH
+ git tag v$VERSION
+
+ # merge into develop
+ git checkout $DEVELOP_BRANCH
+ git merge --no-ff $BRANCH
+
+ # delete branch
+ git branch -d $BRANCH
+
+ # TODO: Implement an optional push to master
+ # git push origin develop; git push origin master; git push --tags origin
+
+ echo
+ echo "Summary of actions:"
+ echo "- Latest objects have been fetched from '$ORIGIN'"
+ echo "- Release branch has been merged into '$MASTER_BRANCH'"
+ echo "- The release was tagged 'v$VERSION'"
+ echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
+ echo "- Release branch '$BRANCH' has been deleted"
+ echo
+}
diff --git a/git-flow-support b/git-flow-support
new file mode 100644
index 0000000..aeaed34
--- /dev/null
+++ b/git-flow-support
@@ -0,0 +1,58 @@
+#
+# gitflow -- A collection of Git wrapper scripts to provide high-level
+# repository operations for Vincent Driessen's branching model:
+#
+# Original blog post presenting this model is found at:
+# http://nvie.com/archives/323
+#
+# Feel free to contribute to this project at:
+# http://github.com/nvie/gitflow
+#
+# Copyright (c) 2010 by Vincent Driessen
+# Copyright (c) 2010 by Benedikt Böhm
+#
+
+usage() {
+ echo "usage: git flow start support <version> [<base>]"
+}
+
+parse_args() {
+ VERSION="$1"
+ BASE="${2:-v${VERSION}}"
+ if [ "$VERSION" = "" ]; then
+ echo "Missing argument <version>."
+ usage
+ exit 1
+ fi
+ PREFIX=$(git config --get gitflow.prefix.support || echo support/)
+ BRANCH=$PREFIX$VERSION
+}
+
+cmd_help() {
+ usage
+ exit 0
+}
+
+cmd_start() {
+ parse_args "$@"
+
+ # sanity checks
+ gitflow_check_clean_working_tree
+
+ # create branch
+ git checkout -b $BRANCH $BASE
+
+ # publish branch
+ git push $ORIGIN $BRANCH:refs/heads/$BRANCH
+ git fetch -q $ORIGIN
+ git config branch.$BRANCH.remote $ORIGIN
+ git config branch.$BRANCH.merge refs/heads/$BRANCH
+ git co $BRANCH
+
+ echo
+ echo "Summary of actions:"
+ echo "- A new remote branch '$BRANCH' was created, based on '$BASE'"
+ echo "- A new tracking branch '$BRANCH' was created"
+ echo "- You are now on branch '$BRANCH'"
+ echo
+}
diff --git a/gitflow-version b/git-flow-version
similarity index 100%
rename from gitflow-version
rename to git-flow-version
diff --git a/gitflow b/gitflow
deleted file mode 100755
index 28da0af..0000000
--- a/gitflow
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-#
-# gitflow -- A collection of Git wrapper scripts to provide high-level
-# repository operations for Vincent Driessen's branching model:
-#
-# Original blog post presenting this model is found at:
-# http://nvie.com/archives/323
-#
-# Feel free to contribute to this project at:
-# http://github.com/nvie/gitflow
-#
-# Copyright (c) 2010 by Vincent Driessen
-#
-
-export GITFLOW_DIR=$(dirname "$0")
-
-usage() {
- . "$GITFLOW_DIR/gitflow-version"
- echo "gitflow, version $GITFLOW_VERSION"
- echo ""
- echo "usage: gitflow <start|finish> <type> <args>"
- echo ""
- echo "arguments:"
- echo "type can be any of: \"feature\", \"release\", \"hotfix\""
- echo ""
-}
-
-check_incoming() {
- if [ "$ACTION" != "start" -a "$ACTION" != "finish" ]; then
- usage
- exit 1
- fi
-
- if [ "$BTYPE" != "feature" -a "$BTYPE" != "release" -a "$BTYPE" != "hotfix" ]; then
- usage
- exit 1
- fi
-}
-
-if [ $# -lt 2 ]; then
- usage
- exit 1
-fi
-
-# Set & check arguments
-ACTION="$1"
-BTYPE="$2"
-shift 2
-check_incoming
-
-# Now, $ACTION and $BTYPE are set
-# It's time to call the appropriate subcommand
-. "$GITFLOW_DIR/gitflow-sh-setup"
-. "$GITFLOW_DIR/gitflow-$BTYPE"
-
-if [ "$ACTION" = "start" ]; then
- start "$@"
-elif [ "$ACTION" = "finish" ]; then
- finish "$@"
-else
- usage
-fi
diff --git a/gitflow-feature b/gitflow-feature
deleted file mode 100755
index 90c9f4c..0000000
--- a/gitflow-feature
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/bin/sh
-#
-# gitflow -- A collection of Git wrapper scripts to provide high-level
-# repository operations for Vincent Driessen's branching model:
-#
-# Original blog post presenting this model is found at:
-# http://nvie.com/archives/323
-#
-# Feel free to contribute to this project at:
-# http://github.com/nvie/gitflow
-#
-# Copyright (c) 2010 by Vincent Driessen
-#
-
-usage() {
- echo "usage: gitflow start feature [<options>] <name> [<base>]"
- echo " gitflow finish feature [<options>] <name>"
- # TODO
- #echo ""
- #echo "options:"
- #echo "--option Explanation"
- #echo ""
- #echo "start-only options:"
- #echo "--option Explanation"
- #echo ""
- #echo "finish-only options:"
- #echo "--rebase Rebases the feature branch on top of develop, instead of merging"
- #echo "--squash Squashes all commits of the feature branch into a single commit"
- #echo " on develop"
- #echo "--push Push to the origin repo when finished"
-}
-
-parse_args() {
- FEATURE="$1"
- if [ $# -eq 2 ]; then
- BASE="$2"
- else
- BASE="develop"
- fi
- if [ "$FEATURE" = "" ]; then
- echo "Missing argument <release>"
- usage
- exit 1
- fi
-}
-
-start() {
- parse_args "$@"
-
- # Checks
- gitflow_check_clean_working_tree
- gitflow_require_branch_absent "$FEATURE"
- if [ "$BASE" = "develop" ]; then
- gitflow_require_branches_equal 'develop' 'origin/develop'
- fi
-
- # All checks passed, ready to roll
- git checkout -b "$FEATURE" "$BASE"
-
- echo ""
- echo "Summary of actions:"
- echo "- A new branch '$FEATURE' was created, based on '$BASE'"
- echo "- You are now on branch '$FEATURE'"
- echo ""
- echo "Now, start committing on your feature. When done, use:"
- echo ""
- echo " gitflow finish feature '$FEATURE'"
-}
-
-finish() {
- parse_args "$@"
-
- # Checks
- gitflow_check_clean_working_tree
- gitflow_require_branch "$FEATURE"
- gitflow_require_branches_equal 'develop' 'origin/develop'
-
- # All checks passed, ready to roll
- git checkout develop
-
- # In case there has been only a single commit in the feature branch, don't
- # use --no-ff, since it has no extra advantages
- FF_FLAG="--no-ff"
- if [ "$(git rev-list develop.."$FEATURE" | wc -l)" -eq 1 ]; then
- FF_FLAG="--ff"
- fi
- git merge "$FF_FLAG" "$FEATURE"
- # TODO: How do we handle merge conflicts here??
- git branch -d "$FEATURE"
-
- echo ""
- echo "Summary of actions:"
- echo "- The feature branch '$FEATURE' was merged into 'develop'"
- #echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
- echo "- Feature branch '$FEATURE' has been removed"
- echo "- You are now on branch 'develop'"
- echo ""
-}
-
diff --git a/gitflow-hotfix b/gitflow-hotfix
deleted file mode 100755
index b1e8834..0000000
--- a/gitflow-hotfix
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/sh
-#
-# gitflow -- A collection of Git wrapper scripts to provide high-level
-# repository operations for Vincent Driessen's branching model:
-#
-# Original blog post presenting this model is found at:
-# http://nvie.com/archives/323
-#
-# Feel free to contribute to this project at:
-# http://github.com/nvie/gitflow
-#
-# Copyright (c) 2010 by Vincent Driessen
-#
-
-usage() {
- echo "usage: gitflow start hotfix <release>"
- echo " gitflow finish hotfix <release>"
- # TODO
- #echo ""
- #echo "options:"
- #echo "--option Explanation"
- #echo ""
- #echo "start-only options:"
- #echo "--option Explanation"
- #echo ""
- #echo "finish-only options:"
- #echo "--push Push to the origin repo when finished"
-}
-
-parse_args() {
- RELEASE="$1"
- if [ "$RELEASE" = "" ]; then
- echo "Missing argument <release>"
- usage
- exit 1
- fi
- HOTFIX_BRANCH="hotfix-$RELEASE"
-}
-
-start() {
- parse_args "$@"
-
- # Checks
- gitflow_check_clean_working_tree
- gitflow_require_branches_equal 'master' 'origin/master'
- gitflow_require_branch_absent "$HOTFIX_BRANCH"
-
- # All checks passed, ready to roll
- git checkout -b "$HOTFIX_BRANCH" master
-
- echo ""
- echo "Summary of actions:"
- echo "- A new branch '$HOTFIX_BRANCH' was created, based on 'master'"
- echo "- You are now on branch '$HOTFIX_BRANCH'"
- echo ""
- echo "Follow-up actions:"
- echo "- Bump the version number now!"
- echo "- Start committing your hot fixes"
- echo "- When done, run:"
- echo ""
- echo " gitflow finish hotfix '$HOTFIX_BRANCH'"
-}
-
-finish() {
- parse_args "$@"
-
- # Checks
- gitflow_check_clean_working_tree
-
- git fetch origin develop # TODO: Make a flag to skip these fetches
- git fetch origin master # TODO: Make a flag to skip these fetches
- gitflow_require_branches_equal 'master' 'origin/master'
- gitflow_require_branches_equal 'develop' 'origin/develop'
-
- # All checks passed, ready to roll
- git checkout master
- git merge --no-ff "$HOTFIX_BRANCH"
- git tag "$RELEASE"
- git checkout develop
- git merge --no-ff "$HOTFIX_BRANCH"
- git branch -d "$HOTFIX_BRANCH"
-
- # TODO: Implement an optional push to master
- # git push origin develop; git push origin master; git push --tags origin
-
- echo ""
- echo "Summary of actions:"
- echo "- Latest objects have been fetched from 'origin'"
- echo "- Hotfix branch has been merged into 'master'"
- echo "- The hotfix was tagged '$RELEASE'"
- echo "- Hotfix branch has been back-merged into 'develop'"
- echo "- Hotfix branch '$HOTFIX_BRANCH' has been deleted"
- echo ""
-}
-
diff --git a/gitflow-release b/gitflow-release
deleted file mode 100755
index b4f2424..0000000
--- a/gitflow-release
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/sh
-#
-# gitflow -- A collection of Git wrapper scripts to provide high-level
-# repository operations for Vincent Driessen's branching model:
-#
-# Original blog post presenting this model is found at:
-# http://nvie.com/archives/323
-#
-# Feel free to contribute to this project at:
-# http://github.com/nvie/gitflow
-#
-# Copyright (c) 2010 by Vincent Driessen
-#
-
-usage() {
- echo "usage: gitflow start release <release>"
- echo " gitflow finish release <release>"
- # TODO
- #echo ""
- #echo "options:"
- #echo "--option Explanation"
- #echo ""
- #echo "start-only options:"
- #echo "--bump <script>"
- #echo " Run the given script to auto-update the version number"
- #echo ""
- #echo "finish-only options:"
- #echo "--push Push to the origin repo when finished"
-}
-
-parse_args() {
- RELEASE="$1"
- if [ "$RELEASE" = "" ]; then
- echo "Missing argument <release>"
- usage
- exit 1
- fi
- RELEASE_BRANCH="release-$RELEASE"
-}
-
-start() {
- parse_args "$@"
-
- # Checks
- gitflow_check_clean_working_tree
- gitflow_require_branches_equal 'develop' 'origin/develop'
- gitflow_require_branch_absent "$RELEASE_BRANCH"
-
- # All checks passed, ready to roll
- git checkout -b "$RELEASE_BRANCH" develop
-
- echo ""
- echo "Summary of actions:"
- echo "- A new branch '$RELEASE_BRANCH' was created, based on 'develop'"
- echo "- You are now on branch '$RELEASE_BRANCH'"
- echo ""
- echo "Follow-up actions:"
- echo "- Bump the version number now!"
- echo "- Start committing last-minute fixes in preparing your release"
- echo "- When done, run:"
- echo ""
- echo " gitflow finish release '$RELEASE_BRANCH'"
-}
-
-finish() {
- parse_args "$@"
-
- # Checks
- gitflow_check_clean_working_tree
-
- git fetch origin develop # TODO: Make a flag to skip these fetches
- git fetch origin master # TODO: Make a flag to skip these fetches
- gitflow_require_branches_equal 'master' 'origin/master'
- gitflow_require_branches_equal 'develop' 'origin/develop'
-
- # All checks passed, ready to roll
- git checkout master
- git merge --no-ff "$RELEASE_BRANCH"
- git tag "$RELEASE"
- git checkout develop
- git merge --no-ff "$RELEASE_BRANCH"
- git branch -d "$RELEASE_BRANCH"
-
- # TODO: Implement an optional push to master
- # git push origin develop; git push origin master; git push --tags origin
-
- echo ""
- echo "Summary of actions:"
- echo "- Latest objects have been fetched from 'origin'"
- echo "- Release branch has been merged into 'master'"
- echo "- The release was tagged '$RELEASE'"
- echo "- Release branch has been back-merged into 'develop'"
- echo "- Release branch '$RELEASE_BRANCH' has been deleted"
- echo ""
-}
-
diff --git a/gitflow-sh-setup b/gitflow-sh-setup
deleted file mode 100755
index 0826758..0000000
--- a/gitflow-sh-setup
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/sh
-#
-# gitflow -- A collection of Git wrapper scripts to provide high-level
-# repository operations for Vincent Driessen's branching model:
-#
-# Original blog post presenting this model is found at:
-# http://nvie.com/archives/323
-#
-# Feel free to contribute to this project at:
-# http://github.com/nvie/gitflow
-#
-# Copyright (c) 2010 by Vincent Driessen
-#
-
-# Get the git dir
-GIT_DIR=$(git rev-parse --git-dir)
-
-# Get all available branches
-LOCAL_BRANCHES=$(git branch | sed 's/^[* ] //')
-REMOTE_BRANCHES=$(git branch -r | sed 's/^[* ] //')
-ALL_BRANCHES="$LOCAL_BRANCHES\n$REMOTE_BRANCHES"
-
-warn() { echo "$@" >&2; }
-die() { warn "$@"; exit 1; }
-
-gitflow_check_clean_working_tree() {
- if [ "$(git status 2>/dev/null | tail -n1)" != "nothing to commit (working directory clean)" ]; then
- die "Working directory is dirty. Only use gitflow in clean working directories for your own safety."
- fi
-}
-
-gitflow_require_local_branch() {
- echo "$LOCAL_BRANCHES" | grep "^$1\$" 2>&1 >/dev/null
- if [ $? -ne 0 ]; then
- die "Local branch '$1' does not exist and is required."
- fi
-}
-
-gitflow_require_remote_branch() {
- echo "$REMOTE_BRANCHES" | grep "^$1\$" 2>&1 >/dev/null
- if [ $? -ne 0 ]; then
- die "Remote branch '$1' does not exist and is required."
- fi
-}
-
-gitflow_require_branch() {
- echo "$ALL_BRANCHES" | grep "^$1\$" 2>&1 >/dev/null
- if [ $? -ne 0 ]; then
- die "Branch '$1' does not exist and is required."
- fi
-}
-
-gitflow_require_branch_absent() {
- echo "$ALL_BRANCHES" | grep "^$1\$" 2>&1 >/dev/null
- if [ $? -eq 0 ]; then
- die "Branch '$1' already exists. Pick another name."
- fi
-}
-
-#
-# gitflow_test_branches_equal()
-#
-# Tests whether branches and their "origin" counterparts have diverged and need
-# merging first. It returns error codes to provide more detail, like so:
-#
-# 0 Branch heads point to the same commit
-# 1 First given branch needs fast-forwarding
-# 2 Second given branch needs fast-forwarding
-# 3 Branch needs a real merge
-#
-gitflow_test_branches_equal() {
- commit1=$(git rev-parse "$1")
- commit2=$(git rev-parse "$2")
- if [ "$commit1" != "$commit2" ]; then
- base=$(git merge-base "$commit1" "$commit2")
- short_base=$(git rev-parse --short "$base")
-
- if [ "$commit1" = "$base" ]; then
- return 1
- elif [ "$commit2" = "$base" ]; then
- return 2
- else
- return 3
- fi
- else
- return 0
- fi
-}
-
-gitflow_require_branches_equal() {
- gitflow_require_local_branch "$1"
- gitflow_require_remote_branch "$2"
- gitflow_test_branches_equal "$1" "$2"
- status=$?
- if [ $status -gt 0 ]; then
- warn "Branches '$1' and '$2' have diverged."
-
- if [ $status -eq 1 ]; then
- die "And branch '$1' may be fast-forwarded."
- elif [ $status -eq 2 ]; then
- # Warn here, since there is no harm in being ahead
- warn "And local branch '$1' is ahead of '$2'."
- else
- die "Branches need merging first."
- fi
- fi
-}
-