Skip to content

Commit

Permalink
Merge branch 'release/0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
nvie committed Oct 18, 2010
2 parents 298514b + 1c289cf commit dc5d08d
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 65 deletions.
3 changes: 3 additions & 0 deletions AUTHORS
Expand Up @@ -7,5 +7,8 @@ Authors are (ordered by first commit date):
- Randy Merrill - Randy Merrill
- Rick Osborne - Rick Osborne
- Mark Derricutt - Mark Derricutt
- Nowell Strite
- Felipe Talavera
- Guillaume-Jean Herbiet


Portions derived from other open source works are clearly marked. Portions derived from other open source works are clearly marked.
18 changes: 18 additions & 0 deletions Changes.mdown
@@ -1,3 +1,21 @@
0.4:
---
Release date: **2010/10/18**

* The flag parsing issues of git-flow subcommands are solved for most
platforms.

* `git flow {feature,hotfix,release} finish` now takes a `-k` flag, to keep the
branch around after finishing.

* `git flow release finish` takes a `-n` flag, to skip tagging.

* For consistency, `git flow {release,hotfix}` now, too, have a `publish` and
`track` subcommand, just like `feature`.

* Various minor fixes.


0.3: 0.3:
---- ----
Release date: **2010/07/22** Release date: **2010/07/22**
Expand Down
115 changes: 107 additions & 8 deletions README.mdown
Expand Up @@ -12,6 +12,15 @@ git-flow installer, which can be run using the following command:


$ wget -q -O - http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo sh $ wget -q -O - http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo sh


For __OSX__ users, the `wget` command isn't available by default, but `curl` is, so you can run:

$ curl http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo sh

For __Windows__ users who wish to use the automated install, it is suggested that you install [Cygwin](http://www.cygwin.com/)
first to install tools like sh and wget. Then simply follow the command:

c:\Users\<user> wget -q -O - http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sh

If you prefer a manual installation, please use the following instructions. If you prefer a manual installation, please use the following instructions.
After downloading the sources from Github, also fetch the submodules: After downloading the sources from Github, also fetch the submodules:


Expand All @@ -30,20 +39,91 @@ where git-flow will be installed, simply specify it explicitly, using:
Or simply point your `PATH` environment variable to your git-flow checkout Or simply point your `PATH` environment variable to your git-flow checkout
directory. directory.


*Installation note:*
git-flow depends on the availability of the command line utility `getopt`,
which may not be available in your Unix/Linux environment. Please use your
favorite package manager to install `getopt`. For Cygwin, install the
`util-linux` package to get `getopt`. If you use `apt-get` as your install
manager, the package name is `opt`.



Integration with your shell Integration with your shell
--------------------------- ---------------------------
For those who use the [Bash](http://www.gnu.org/software/bash/) shell, please For those who use the [Bash](http://www.gnu.org/software/bash/) or
check out the excellent work on the [ZSH](http://www.zsh.org) shell, please check out the excellent work on the
[git-flow-completion](http://github.com/bobthecow/git-flow-completion) project [git-flow-completion](http://github.com/bobthecow/git-flow-completion) project
by [bobthecow](http://github.com/bobthecow). It offers tab-completion for all by [bobthecow](http://github.com/bobthecow). It offers tab-completion for all
git-flow subcommands and branch names. git-flow subcommands and branch names.


If you are a [zsh](http://www.zsh.org) user with some plugin-writing For Windows users, [msysgit](http://code.google.com/p/msysgit/) is a good
experience, please help us develop a starting place for installing git.
[completion plugin](http://github.com/bobthecow/git-flow-completion/issues#issue/1)
for zsh, too. Please contact me on [Github](http://github.com/inbox/new/nvie)
or [Twitter](http://twitter.com/nvie) to discuss details. FAQ
---
* **Can I still do manual branches and merges when I use git-flow?**
Of course you can. `git-flow` does not forbid you to keep using vanilla Git
commands!

So if you want to merge `master` into `develop` for whatever reason you want
to, you can safely do so without breaking `git-flow` compatibility. Do you
want to manually merge a feature branch X into another feature branch Y? Not
a problem. As long as you do it conciously and realize what this means for
finishing those branches later on.

* **Why does git-describe not work for me?**
When finishing release and hotfix branches, that branch's HEAD is first
merged into `master` and then into `develop`. It is not the resulting new
merge commit from `master` that is merged back into `develop`. This means
that a linear path from the new `develop` branch to the new `master` commit
is not created. Even worse, a linear path is created from the new `develop`
branch to the *previous* `master` commit. Although unintended, this is
simply an effect of using the current branching rules.

When using `git-describe` in these cases, you can get very confusing and
misleading results, since `git-describe` scans the current commits linear
history for the most recent tag it finds, which will always be the *previous*
tag.

I will change this behaviour in the next version of the branching model
explicitly and I will include this behavioural change in the first version of
the Python rewrite.

For more references to this problem, see:

- Issue [#49](http://github.com/nvie/gitflow/issues/49)
- These
[two](http://groups.google.com/group/gitflow-users/browse\_thread/thread/9920a7df3d1c4908/0bb18a0bf7275ad6#0bb18a0bf7275ad6)
[discussions](http://groups.google.com/group/gitflow-users/browse\_thread/thread/19efac724bb6418a)
on the [git-flow-users](http://groups.google.com/group/gitflow-users)
mailinglist.

* **I'm getting errors when I use flags with git-flow!**
`git-flow` uses the [shFlags](http://code.google.com/p/shflags/) library to
provide platform independent flag parsing (using wichever low-level flag
parsing libraries like `getopt` or `getopts` are available). However,
`shFlags` does not work too well on a few platforms that haven't been tested
originally. This results in errors like this:

flags:WARN getopt: option invalide -- 'f' -- 'init' flags:FATAL unable to parse provided options with getopt

The platforms that suffer these errors include:

- Gentoo
- Ubuntu
- Redhat Enterprise Linux

There are open issues related to this:
[#28](http://github.com/nvie/gitflow/issues/28) and
[#39](http://github.com/nvie/gitflow/issues/39). Unfortunately, there is no
simple fix for it and all hope is placed on the Python rewrite of `git-flow`,
see issue [#33](http://github.com/nvie/gitflow/issues/33).

* **Can I use it with Windows?**
There have been reports of Windows users using `git-flow`.
<del>Un</del>fortunately, I have no Windows environment to test it on, but
this [issue](http://github.com/nvie/gitflow/issues/issue/25) should be
helpful in setting it up.




Please help out Please help out
Expand All @@ -57,7 +137,7 @@ Feel free to fork this repo and to commit your additions. For a list of all
contributors, please see the [AUTHORS](AUTHORS) file. contributors, please see the [AUTHORS](AUTHORS) file.


Any questions, tips, or general discussion can be posted to our Google group: Any questions, tips, or general discussion can be posted to our Google group:
http://groups.google.com/group/gitflow-users [http://groups.google.com/group/gitflow-users](http://groups.google.com/group/gitflow-users)




License terms License terms
Expand All @@ -71,6 +151,11 @@ in a Github fork, of course.


Typical usage: Typical usage:
-------------- --------------
For the best introduction to get started to `git flow`, please read Jeff
Kreeftmeijer's blog post:

[http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/)



### Initialization ### Initialization


Expand Down Expand Up @@ -117,3 +202,17 @@ those questions to accept the (sane) default suggestions.


For support branches, the `<base>` arg must be a commit on `master`. For support branches, the `<base>` arg must be a commit on `master`.



Showing your appreciation
=========================
A few people already requested it, so now it's here: a Flattr button.

Of course, the best way to show your appreciation for the original
[blog post](http://nvie.com/git-model) or the git-flow tool itself remains
contributing to the community. If you'd like to show your appreciation in
another way, however, consider Flattr'ing me:

[![Flattr this][2]][1]

[1]: http://flattr.com/thing/53771/git-flow
[2]: http://api.flattr.com/button/button-static-50x60.png
5 changes: 5 additions & 0 deletions git-flow
Expand Up @@ -67,6 +67,11 @@ main() {
# load common functionality # load common functionality
. "$GITFLOW_DIR/gitflow-common" . "$GITFLOW_DIR/gitflow-common"


# This environmental variable fixes non-POSIX getopt style argument
# parsing, effectively breaking git-flow subcommand parsing on several
# Linux platforms.
export POSIXLY_CORRECT=1

# use the shFlags project to parse the command line arguments # use the shFlags project to parse the command line arguments
. "$GITFLOW_DIR/gitflow-shFlags" . "$GITFLOW_DIR/gitflow-shFlags"
FLAGS_PARENT="git flow" FLAGS_PARENT="git flow"
Expand Down
21 changes: 15 additions & 6 deletions git-flow-feature
Expand Up @@ -44,7 +44,7 @@ PREFIX=$(git config --get gitflow.prefix.feature)
usage() { usage() {
echo "usage: git flow feature [list] [-v]" echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-F] <name> [<base>]" echo " git flow feature start [-F] <name> [<base>]"
echo " git flow feature finish [-rF] <name|nameprefix>" echo " git flow feature finish [-rFk] <name|nameprefix>"
echo " git flow feature publish <name>" echo " git flow feature publish <name>"
echo " git flow feature track <name>" echo " git flow feature track <name>"
echo " git flow feature diff [<name|nameprefix>]" echo " git flow feature diff [<name|nameprefix>]"
Expand Down Expand Up @@ -74,7 +74,7 @@ cmd_list() {
warn "" warn ""
exit 0 exit 0
fi fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g') current_branch=$(git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$feature_branches" | sed "s ^$PREFIX g") short_names=$(echo "$feature_branches" | sed "s ^$PREFIX g")


# determine column width first # determine column width first
Expand Down Expand Up @@ -180,7 +180,7 @@ parse_args() {
parse_cmdline "$@" parse_cmdline "$@"


# read arguments into global variables # read arguments into global variables
NAME=$1 NAME=$(last_arg "$@")
BRANCH=$PREFIX$NAME BRANCH=$PREFIX$NAME
} }


Expand Down Expand Up @@ -231,7 +231,8 @@ cmd_start() {


cmd_finish() { cmd_finish() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean rebase false 'rebase instead of merge' r DEFINE_boolean rebase false "rebase instead of merge" r
DEFINE_boolean keep false "keep branch after performing finish" k
parse_args "$@" parse_args "$@"
expand_nameprefix_arg expand_nameprefix_arg


Expand Down Expand Up @@ -343,13 +344,21 @@ helper_finish_cleanup() {
if flag fetch; then if flag fetch; then
git push "$ORIGIN" ":refs/heads/$BRANCH" git push "$ORIGIN" ":refs/heads/$BRANCH"
fi fi
git branch -D "$BRANCH"

if noflag keep; then
git branch -d "$BRANCH"
fi


echo echo
echo "Summary of actions:" echo "Summary of actions:"
echo "- The feature branch '$BRANCH' was merged into '$DEVELOP_BRANCH'" echo "- The feature branch '$BRANCH' was merged into '$DEVELOP_BRANCH'"
#echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported #echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
echo "- Feature branch '$BRANCH' has been removed" if flag keep; then
echo "- Feature branch '$BRANCH' is still available"
else
echo "- Feature branch '$BRANCH' has been removed"
fi
echo "- You are now on branch '$DEVELOP_BRANCH'" echo "- You are now on branch '$DEVELOP_BRANCH'"
echo echo
} }
Expand Down
56 changes: 35 additions & 21 deletions git-flow-hotfix
Expand Up @@ -39,13 +39,13 @@
require_git_repo require_git_repo
require_gitflow_initialized require_gitflow_initialized
gitflow_load_settings gitflow_load_settings
VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag) VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
PREFIX=$(git config --get gitflow.prefix.hotfix) PREFIX=$(git config --get gitflow.prefix.hotfix)


usage() { usage() {
echo "usage: git flow hotfix [list] [-v]" echo "usage: git flow hotfix [list] [-v]"
echo " git flow hotfix start [-F] <version> [<base>]" echo " git flow hotfix start [-F] <version> [<base>]"
echo " git flow hotfix finish [-Fsump] <version>" echo " git flow hotfix finish [-Fsumpk] <version>"
} }


cmd_default() { cmd_default() {
Expand All @@ -69,7 +69,7 @@ cmd_list() {
warn "" warn ""
exit 0 exit 0
fi fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g') current_branch=$(git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$hotfix_branches" | sed "s ^$PREFIX g") short_names=$(echo "$hotfix_branches" | sed "s ^$PREFIX g")


# determine column width first # determine column width first
Expand Down Expand Up @@ -124,7 +124,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}" eval set -- "${FLAGS_ARGV}"


# read arguments into global variables # read arguments into global variables
VERSION=$1 VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION BRANCH=$PREFIX$VERSION
} }


Expand All @@ -137,7 +137,7 @@ require_version_arg() {
} }


require_base_is_on_master() { require_base_is_on_master() {
if ! git branch --contains "$BASE" 2>/dev/null \ if ! git branch --no-color --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \ | sed 's/[* ] //g' \
| grep -q "^$MASTER_BRANCH\$"; then | grep -q "^$MASTER_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$MASTER_BRANCH'." die "fatal: Given base '$BASE' is not a valid commit on '$MASTER_BRANCH'."
Expand Down Expand Up @@ -194,6 +194,8 @@ cmd_finish() {
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m DEFINE_string message "" "use the given tag message" m
DEFINE_boolean push false "push to $ORIGIN after performing finish" p DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean notag false "don't tag this release" n
parse_args "$@" parse_args "$@"
require_version_arg require_version_arg


Expand Down Expand Up @@ -229,17 +231,19 @@ cmd_finish() {
# TODO: What do we do now? # TODO: What do we do now?
fi fi


# try to tag the release if noflag notag; then
# in case a previous attempt to finish this release branch has failed, # try to tag the release
# but the tag was set successful, we skip it now # in case a previous attempt to finish this release branch has failed,
local tagname=$VERSION_PREFIX$VERSION # but the tag was set successful, we skip it now
if ! git_tag_exists "$tagname"; then local tagname=$VERSION_PREFIX$VERSION
local opts="-a" if ! git_tag_exists "$tagname"; then
flag sign && opts="$opts -s" local opts="-a"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'" flag sign && opts="$opts -s"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'" [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
git tag $opts "$VERSION_PREFIX$VERSION" || \ [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
die "Tagging failed. Please run finish again to retry." git tag $opts "$VERSION_PREFIX$VERSION" || \
die "Tagging failed. Please run finish again to retry."
fi
fi fi


# try to merge into develop # try to merge into develop
Expand All @@ -257,24 +261,34 @@ cmd_finish() {
fi fi


# delete branch # delete branch
git branch -d "$BRANCH" if noflag keep; then
git branch -d "$BRANCH"
fi


if flag push; then if flag push; then
git push "$ORIGIN" "$DEVELOP_BRANCH" || \ git push "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not push to $DEVELOP_BRANCH from $ORIGIN." die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git push "$ORIGIN" "$MASTER_BRANCH" || \ git push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN." die "Could not push to $MASTER_BRANCH from $ORIGIN."
git push --tags "$ORIGIN" || \ if noflag notag; then
die "Could not push tags to $ORIGIN." git push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN."
fi
fi fi


echo echo
echo "Summary of actions:" echo "Summary of actions:"
echo "- Latest objects have been fetched from '$ORIGIN'" echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Hotfix branch has been merged into '$MASTER_BRANCH'" echo "- Hotfix branch has been merged into '$MASTER_BRANCH'"
echo "- The hotfix was tagged '$VERSION_PREFIX$VERSION'" if noflag notag; then
echo "- The hotfix was tagged '$VERSION_PREFIX$VERSION'"
fi
echo "- Hotfix branch has been back-merged into '$DEVELOP_BRANCH'" echo "- Hotfix branch has been back-merged into '$DEVELOP_BRANCH'"
echo "- Hotfix branch '$BRANCH' has been deleted" if flag keep; then
echo "- Hotfix branch '$BRANCH' is still available"
else
echo "- Hotfix branch '$BRANCH' has been deleted"
fi
if flag push; then if flag push; then
echo "- '$DEVELOP_BRANCH', '$MASTER_BRANCH' and tags have been pushed to '$ORIGIN'" echo "- '$DEVELOP_BRANCH', '$MASTER_BRANCH' and tags have been pushed to '$ORIGIN'"
fi fi
Expand Down

0 comments on commit dc5d08d

Please sign in to comment.