Skip to content

Commit 2a40e6a

Browse files
committed
Merge branch 'release-0.1'
2 parents a9575ca + f206ba6 commit 2a40e6a

File tree

10 files changed

+573
-0
lines changed

10 files changed

+573
-0
lines changed

README

Whitespace-only changes.

README.mdown

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
gitflow
2+
=======
3+
A collection of Git wrapper scripts to provide high-level repository operations
4+
for Vincent Driessen's [branching model](http://nvie.com/archives/323 "original
5+
blog post").
6+
7+
8+
Release 0.1
9+
-----------
10+
A quick release of version 0.1 has arrived. The main script are functional and
11+
should be usable under "normal" use.
12+
13+
There have barely been any real-world tests, but I encourage you to start using
14+
it actively. [Feedback](http://github.com/nvie/gitflow/issues) is also very
15+
welcome. See the "Please help out" section below, also.
16+
17+
**Make sure to validate the modifications to your repo after running any of the
18+
`gitflow` commands, before pushing them permanently.**
19+
20+
21+
Installing gitflow
22+
------------------
23+
There isn't a real Unix installer available, but the project is so small that
24+
installing it is easy.
25+
26+
Either:
27+
28+
- Put the `gitflow` directory anywhere on your Unix `PATH` variable; or
29+
- Run:
30+
31+
$ git clone git://github.com/nvie/gitflow
32+
$ cd gitflow
33+
$ cp gitflow* /usr/local/bin
34+
35+
36+
Please help out
37+
---------------
38+
This project is still under development. What is available today is merely its
39+
foundation. However, it is functional in its current form and should be usable
40+
under normal use. (Don't try to create multiple release branches next to each
41+
other and stuff like that, yet.)
42+
43+
Feedback and suggestions are very welcome and I encourage you to use the
44+
[Issues list](http://github.com/nvie/gitflow/issues) on Github to provide that
45+
feedback.
46+
47+
Feel free to fork this repo and to commit your additions.
48+
49+
50+
Example uses:
51+
-------------
52+
53+
* To start a new feature branch, use:
54+
55+
gitflow start feature <name> [<base>]
56+
gitflow start feature foo-support
57+
58+
`base` is `develop` by default.
59+
60+
* To finish this feature and have it merged into `develop`, use:
61+
62+
gitflow finish feature <name>
63+
gitflow finish feature foo-support
64+
65+
* To start a new release branch for 2.0, based on the 1.1 production release, use:
66+
67+
gitflow start release <release>
68+
gitflow start release 2.0
69+
70+
* To finish the release branch (i.e. to make an actual production release), use:
71+
72+
gitflow finish release <release>
73+
gitflow finish release 2.0
74+
75+
* To start a new hotfix branch for 2.1, based on the 2.0 production release, use:
76+
77+
gitflow start hotfix <release> [<base-release>]
78+
gitflow start hotfix 2.1 2.0
79+
80+
* To finish the hotfix branch, use:
81+
82+
gitflow finish hotfix <release>
83+
gitflow finish hotfix 2.1
84+

TODO.mdown

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
TODO-list
2+
=========
3+
4+
General configuration
5+
---------------------
6+
- Support configurable naming for fixed branch names 'master' and 'develop'
7+
- Support configurable naming conventions (i.e. name prefixes) for supporting
8+
branches, instead of fixed 'release-\*' and 'hotfix-\*'
9+
10+
Release branch support
11+
----------------------
12+
- Take care of the situation where two release branches live next to each
13+
other. In that situation, a "finish release" action should merge back changes
14+
into the other release, not into 'develop'. Or at least warn about it. Or not
15+
support creating a new release branch if the other isn't finished yet.

bump-version

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
usage() {
3+
echo "usage: bump-version <version-id>"
4+
}
5+
6+
if [ $# -ne 1 ]; then
7+
usage
8+
exit 1
9+
fi
10+
11+
echo "GITFLOW_VERSION=$1" > gitflow-version
12+
git add gitflow-version
13+
git commit -m "Bumped version number to $1" gitflow-version

gitflow

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/sh
2+
#
3+
# gitflow -- A collection of Git wrapper scripts to provide high-level
4+
# repository operations for Vincent Driessen's branching model:
5+
#
6+
# Original blog post presenting this model is found at:
7+
# http://nvie.com/archives/323
8+
#
9+
# Feel free to contribute to this project at:
10+
# http://github.com/nvie/gitflow
11+
#
12+
# Copyright (c) 2010 by Vincent Driessen
13+
#
14+
15+
export GITFLOW_DIR=$(dirname "$0")
16+
17+
usage() {
18+
. "$GITFLOW_DIR/gitflow-version"
19+
echo "gitflow, version $GITFLOW_VERSION"
20+
echo ""
21+
echo "usage: gitflow <start|finish> <type> <args>"
22+
echo ""
23+
echo "arguments:"
24+
echo "type can be any of: \"feature\", \"release\", \"hotfix\""
25+
echo ""
26+
}
27+
28+
check_incoming() {
29+
if [ "$ACTION" != "start" -a "$ACTION" != "finish" ]; then
30+
usage
31+
exit 1
32+
fi
33+
34+
if [ "$BTYPE" != "feature" -a "$BTYPE" != "release" -a "$BTYPE" != "hotfix" ]; then
35+
usage
36+
exit 1
37+
fi
38+
}
39+
40+
if [ $# -lt 2 ]; then
41+
usage
42+
exit 1
43+
fi
44+
45+
# Set & check arguments
46+
ACTION="$1"
47+
BTYPE="$2"
48+
shift 2
49+
check_incoming
50+
51+
# Now, $ACTION and $BTYPE are set
52+
# It's time to call the appropriate subcommand
53+
. "$GITFLOW_DIR/gitflow-sh-setup"
54+
. "$GITFLOW_DIR/gitflow-$BTYPE"
55+
56+
if [ "$ACTION" = "start" ]; then
57+
start "$@"
58+
elif [ "$ACTION" = "finish" ]; then
59+
finish "$@"
60+
else
61+
usage
62+
fi

gitflow-feature

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/sh
2+
#
3+
# gitflow -- A collection of Git wrapper scripts to provide high-level
4+
# repository operations for Vincent Driessen's branching model:
5+
#
6+
# Original blog post presenting this model is found at:
7+
# http://nvie.com/archives/323
8+
#
9+
# Feel free to contribute to this project at:
10+
# http://github.com/nvie/gitflow
11+
#
12+
# Copyright (c) 2010 by Vincent Driessen
13+
#
14+
15+
usage() {
16+
echo "usage: gitflow start feature [<options>] <name> [<base>]"
17+
echo " gitflow finish feature [<options>] <name>"
18+
# TODO
19+
#echo ""
20+
#echo "options:"
21+
#echo "--option Explanation"
22+
#echo ""
23+
#echo "start-only options:"
24+
#echo "--option Explanation"
25+
#echo ""
26+
#echo "finish-only options:"
27+
#echo "--rebase Rebases the feature branch on top of develop, instead of merging"
28+
#echo "--squash Squashes all commits of the feature branch into a single commit"
29+
#echo " on develop"
30+
#echo "--push Push to the origin repo when finished"
31+
}
32+
33+
parse_args() {
34+
FEATURE="$1"
35+
if [ $# -eq 2 ]; then
36+
BASE="$2"
37+
else
38+
BASE="develop"
39+
fi
40+
if [ "$FEATURE" = "" ]; then
41+
echo "Missing argument <release>"
42+
usage
43+
exit 1
44+
fi
45+
}
46+
47+
start() {
48+
parse_args "$@"
49+
50+
# Checks
51+
gitflow_check_clean_working_tree
52+
gitflow_require_branch_absent "$FEATURE"
53+
if [ "$BASE" = "develop" ]; then
54+
gitflow_require_branches_equal 'develop' 'origin/develop'
55+
fi
56+
57+
# All checks passed, ready to roll
58+
git checkout -b "$FEATURE" "$BASE"
59+
60+
echo ""
61+
echo "Summary of actions:"
62+
echo "- A new branch '$FEATURE' was created, based on '$BASE'"
63+
echo "- You are now on branch '$FEATURE'"
64+
echo ""
65+
echo "Now, start committing on your feature. When done, use:"
66+
echo ""
67+
echo " gitflow finish feature '$FEATURE'"
68+
}
69+
70+
finish() {
71+
parse_args "$@"
72+
73+
# Checks
74+
gitflow_check_clean_working_tree
75+
gitflow_require_branch "$FEATURE"
76+
gitflow_require_branches_equal 'develop' 'origin/develop'
77+
78+
# All checks passed, ready to roll
79+
git checkout develop
80+
81+
# In case there has been only a single commit in the feature branch, don't
82+
# use --no-ff, since it has no extra advantages
83+
FF_FLAG="--no-ff"
84+
if [ "$(git rev-list develop.."$FEATURE" | wc -l)" -eq 1 ]; then
85+
FF_FLAG="--ff"
86+
fi
87+
git merge "$FF_FLAG" "$FEATURE"
88+
# TODO: How do we handle merge conflicts here??
89+
git branch -d "$FEATURE"
90+
91+
echo ""
92+
echo "Summary of actions:"
93+
echo "- The feature branch '$FEATURE' was merged into 'develop'"
94+
#echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
95+
echo "- Feature branch '$FEATURE' has been removed"
96+
echo "- You are now on branch 'develop'"
97+
echo ""
98+
}
99+

gitflow-hotfix

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/sh
2+
#
3+
# gitflow -- A collection of Git wrapper scripts to provide high-level
4+
# repository operations for Vincent Driessen's branching model:
5+
#
6+
# Original blog post presenting this model is found at:
7+
# http://nvie.com/archives/323
8+
#
9+
# Feel free to contribute to this project at:
10+
# http://github.com/nvie/gitflow
11+
#
12+
# Copyright (c) 2010 by Vincent Driessen
13+
#
14+
15+
usage() {
16+
echo "usage: gitflow start hotfix <release>"
17+
echo " gitflow finish hotfix <release>"
18+
# TODO
19+
#echo ""
20+
#echo "options:"
21+
#echo "--option Explanation"
22+
#echo ""
23+
#echo "start-only options:"
24+
#echo "--option Explanation"
25+
#echo ""
26+
#echo "finish-only options:"
27+
#echo "--push Push to the origin repo when finished"
28+
}
29+
30+
parse_args() {
31+
RELEASE="$1"
32+
if [ "$RELEASE" = "" ]; then
33+
echo "Missing argument <release>"
34+
usage
35+
exit 1
36+
fi
37+
HOTFIX_BRANCH="hotfix-$RELEASE"
38+
}
39+
40+
start() {
41+
parse_args "$@"
42+
43+
# Checks
44+
gitflow_check_clean_working_tree
45+
gitflow_require_branches_equal 'master' 'origin/master'
46+
gitflow_require_branch_absent "$HOTFIX_BRANCH"
47+
48+
# All checks passed, ready to roll
49+
git checkout -b "$HOTFIX_BRANCH" master
50+
51+
echo ""
52+
echo "Summary of actions:"
53+
echo "- A new branch '$HOTFIX_BRANCH' was created, based on 'master'"
54+
echo "- You are now on branch '$HOTFIX_BRANCH'"
55+
echo ""
56+
echo "Follow-up actions:"
57+
echo "- Bump the version number now!"
58+
echo "- Start committing your hot fixes"
59+
echo "- When done, run:"
60+
echo ""
61+
echo " gitflow finish hotfix '$HOTFIX_BRANCH'"
62+
}
63+
64+
finish() {
65+
parse_args "$@"
66+
67+
# Checks
68+
gitflow_check_clean_working_tree
69+
70+
git fetch origin develop # TODO: Make a flag to skip these fetches
71+
git fetch origin master # TODO: Make a flag to skip these fetches
72+
gitflow_require_branches_equal 'master' 'origin/master'
73+
gitflow_require_branches_equal 'develop' 'origin/develop'
74+
75+
# All checks passed, ready to roll
76+
git checkout master
77+
git merge --no-ff "$HOTFIX_BRANCH"
78+
git tag "$RELEASE"
79+
git checkout develop
80+
git merge --no-ff "$HOTFIX_BRANCH"
81+
git branch -d "$HOTFIX_BRANCH"
82+
83+
# TODO: Implement an optional push to master
84+
# git push origin develop; git push origin master; git push --tags origin
85+
86+
echo ""
87+
echo "Summary of actions:"
88+
echo "- Latest objects have been fetched from 'origin'"
89+
echo "- Hotfix branch has been merged into 'master'"
90+
echo "- The hotfix was tagged '$RELEASE'"
91+
echo "- Hotfix branch has been back-merged into 'develop'"
92+
echo "- Hotfix branch '$HOTFIX_BRANCH' has been deleted"
93+
echo ""
94+
}
95+

0 commit comments

Comments
 (0)