Permalink
Browse files

Merge branch 'release-0.1'

  • Loading branch information...
2 parents a9575ca + f206ba6 commit 2a40e6abadbb83bd2ff634f2711b5366a0860b03 @nvie committed Jan 26, 2010
Showing with 573 additions and 0 deletions.
  1. 0 README
  2. +84 −0 README.mdown
  3. +15 −0 TODO.mdown
  4. +13 −0 bump-version
  5. +62 −0 gitflow
  6. +99 −0 gitflow-feature
  7. +95 −0 gitflow-hotfix
  8. +96 −0 gitflow-release
  9. +108 −0 gitflow-sh-setup
  10. +1 −0 gitflow-version
View
No changes.
View
@@ -0,0 +1,84 @@
+gitflow
+=======
+A collection of Git wrapper scripts to provide high-level repository operations
+for Vincent Driessen's [branching model](http://nvie.com/archives/323 "original
+blog post").
+
+
+Release 0.1
+-----------
+A quick release of version 0.1 has arrived. The main script are functional and
+should be usable under "normal" use.
+
+There have barely been any real-world tests, but I encourage you to start using
+it actively. [Feedback](http://github.com/nvie/gitflow/issues) is also very
+welcome. See the "Please help out" section below, also.
+
+**Make sure to validate the modifications to your repo after running any of the
+`gitflow` commands, before pushing them permanently.**
+
+
+Installing gitflow
+------------------
+There isn't a real Unix installer available, but the project is so small that
+installing it is easy.
+
+Either:
+
+- Put the `gitflow` directory anywhere on your Unix `PATH` variable; or
+- Run:
+
+ $ git clone git://github.com/nvie/gitflow
+ $ cd gitflow
+ $ cp gitflow* /usr/local/bin
+
+
+Please help out
+---------------
+This project is still under development. What is available today is merely its
+foundation. However, it is functional in its current form and should be usable
+under normal use. (Don't try to create multiple release branches next to each
+other and stuff like that, yet.)
+
+Feedback and suggestions are very welcome and I encourage you to use the
+[Issues list](http://github.com/nvie/gitflow/issues) on Github to provide that
+feedback.
+
+Feel free to fork this repo and to commit your additions.
+
+
+Example uses:
+-------------
+
+* To start a new feature branch, use:
+
+ gitflow start feature <name> [<base>]
+ gitflow start feature foo-support
+
+ `base` is `develop` by default.
+
+* To finish this feature and have it merged into `develop`, use:
+
+ gitflow finish feature <name>
+ gitflow finish feature foo-support
+
+* To start a new release branch for 2.0, based on the 1.1 production release, use:
+
+ gitflow start release <release>
+ gitflow start release 2.0
+
+* To finish the release branch (i.e. to make an actual production release), use:
+
+ gitflow finish release <release>
+ gitflow finish release 2.0
+
+* To start a new hotfix branch for 2.1, based on the 2.0 production release, use:
+
+ gitflow start hotfix <release> [<base-release>]
+ gitflow start hotfix 2.1 2.0
+
+* To finish the hotfix branch, use:
+
+ gitflow finish hotfix <release>
+ gitflow finish hotfix 2.1
+
View
@@ -0,0 +1,15 @@
+TODO-list
+=========
+
+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
+----------------------
+- Take care of the situation where two release branches live next to each
+ other. In that situation, a "finish release" action should merge back changes
+ into the other release, not into 'develop'. Or at least warn about it. Or not
+ support creating a new release branch if the other isn't finished yet.
View
@@ -0,0 +1,13 @@
+#!/bin/sh
+usage() {
+ echo "usage: bump-version <version-id>"
+}
+
+if [ $# -ne 1 ]; then
+ usage
+ exit 1
+fi
+
+echo "GITFLOW_VERSION=$1" > gitflow-version
+git add gitflow-version
+git commit -m "Bumped version number to $1" gitflow-version
View
@@ -0,0 +1,62 @@
+#!/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
View
@@ -0,0 +1,99 @@
+#!/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 ""
+}
+
View
@@ -0,0 +1,95 @@
+#!/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 ""
+}
+
Oops, something went wrong. Retry.

0 comments on commit 2a40e6a

Please sign in to comment.