Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue #49: Be git-describe friendly by back-merging release branch/tag into development branch #179

Open
wants to merge 5 commits into from

7 participants

@bloveridge

This replaces pull request #85, which became difficult to maintain due to the fact that I didn't base my pull request off a feature branch (old newb mistake).

This pull request modifies the release finish command to back-merge the release branch (or the release tag if it was created) into the development branch as the final step of finishing a release. This makes the tag an ancestor of the development branch, which in turn enables git describe to be meaningful on the development branch as well as the release branch.

bloveridge and others added some commits
@bloveridge bloveridge merge master into develop when finishing a release. If tag, merge the…
… tag; if notag, merge the master branch. This subtly changes the merge message to align with what flags were provided.
e640746
@bloveridge bloveridge make back-merging of the production branch into develop optional, and…
… default it to false -- this preserves original functionailty by default
fddaac5
@gvangool gvangool Do the backmerge by default 8879745
@bloveridge bloveridge add short flag for turning on nobackmerge 595a992
@n8gray

Does this handle hotfix releases as well?

@bloveridge
@n8gray

Excellent! I'm thinking about introducing git flow into my company for our transition from svn to git, but I was concerned about the problem it caused with git describe. This is a big help.

@sjaeckel

It'd be nice if this feature would go into the main repository as fast as possible!
We're using currently my fork to install git flow in my company because it's not yet integrated...

@bloveridge

We do the same thing at my company. I maintain an alternate homebrew formula that points to my fork and people install using that formula.

This pull request has now been open since December 2010 in one form or another. Maybe it will be merged before another year passes :)

@danthegoodman

I too would like to see this feature merged in.

@sjaeckel

We're going the same way as @bloveridge proposed. You can find a simple installer at https://github.com/stzedn/gitflow_msys_install that clones gitflow from my private fork.

@petervanderdoes

The above functionality is included in my fork, The -b functionality is currently only implemented in the develop branch.

My fork also has implementations of other issues posted on the original, most importantly the functionality of hooks and filters as requested in issue #171

@keybounce

What is the current status of resolving this issue?

@petervanderdoes

@keybounce Considering the last commit in this repository was on Sep 25, 2012 I doubt it will be resolved in this repository.

@keybounce

Ahh. Is there an up to date fork of this that does solve this?

@bloveridge
@petervanderdoes

@keybounce as @bloveridge said check my fork git flow AVH Edition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 20, 2011
  1. @bloveridge

    merge master into develop when finishing a release. If tag, merge the…

    bloveridge authored
    … tag; if notag, merge the master branch. This subtly changes the merge message to align with what flags were provided.
  2. @bloveridge

    make back-merging of the production branch into develop optional, and…

    bloveridge authored
    … default it to false -- this preserves original functionailty by default
  3. @gvangool @bloveridge

    Do the backmerge by default

    gvangool authored bloveridge committed
  4. @bloveridge
Commits on Feb 28, 2012
  1. @bloveridge
This page is out of date. Refresh to see the latest.
Showing with 78 additions and 26 deletions.
  1. +39 −13 git-flow-hotfix
  2. +39 −13 git-flow-release
View
52 git-flow-hotfix
@@ -224,6 +224,7 @@ cmd_finish() {
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
+ DEFINE_boolean nobackmerge false "don't back-merge $MASTER_BRANCH to be a parent of $DEVELOP_BRANCH (using tag if applicable)" b
parse_args "$@"
require_version_arg
@@ -275,17 +276,35 @@ cmd_finish() {
fi
# try to merge into develop
- # in case a previous attempt to finish this release branch has failed,
- # but the merge into develop was successful, we skip it now
- if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
- git checkout "$DEVELOP_BRANCH" || \
- die "Could not check out $DEVELOP_BRANCH."
-
- # TODO: Actually, accounting for 'git describe' pays, so we should
- # ideally git merge --no-ff $tagname here, instead!
- git merge --no-ff "$BRANCH" || \
- die "There were merge conflicts."
- # TODO: What do we do now?
+ if noflag nobackmerge; then
+ # in case a previous attempt to finish this hotfix branch has failed,
+ # but the merge into develop was successful, we skip it now
+ if ! git_is_branch_merged_into "$MASTER_BRANCH" "$DEVELOP_BRANCH"; then
+ git checkout "$DEVELOP_BRANCH" || \
+ die "Could not check out $DEVELOP_BRANCH."
+
+ # merge the master branch back into develop; this makes the master
+ # branch - and the new tag (if provided) - a parent of the development
+ # branch, which in turn lets you use 'git describe' on either branch
+ if noflag notag; then
+ git merge --no-ff "$tagname" || \
+ die "There were merge conflicts."
+ else
+ git merge --no-ff "$MASTER_BRANCH" || \
+ die "There were merge conflicts."
+ fi
+ fi
+ else
+ # in case a previous attempt to finish this hotfix branch has failed,
+ # but the merge into develop was successful, we skip it now
+ if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
+ git checkout "$DEVELOP_BRANCH" || \
+ die "Could not check out $DEVELOP_BRANCH."
+
+ # just merge the release branch into the development branch
+ git merge --no-ff "$BRANCH" || \
+ die "There were merge conflicts."
+ fi
fi
# delete branch
@@ -309,9 +328,16 @@ cmd_finish() {
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Hotfix branch has been merged into '$MASTER_BRANCH'"
if noflag notag; then
- echo "- The hotfix was tagged '$VERSION_PREFIX$VERSION'"
+ echo "- The hotfix was tagged '$tagname'"
+ if noflag nobackmerge; then
+ echo "- Tag '$tagname' has been back-merged into '$DEVELOP_BRANCH'"
+ fi
+ fi
+ if flag nobackmerge; then
+ echo "- Hotfix branch has been back-merged into '$DEVELOP_BRANCH'"
+ else
+ echo "- Branch '$MASTER_BRANCH' has been back-merged into '$DEVELOP_BRANCH'"
fi
- echo "- Hotfix branch has been back-merged into '$DEVELOP_BRANCH'"
if flag keep; then
echo "- Hotfix branch '$BRANCH' is still available"
else
View
52 git-flow-release
@@ -45,7 +45,7 @@ PREFIX=$(git config --get gitflow.prefix.release)
usage() {
echo "usage: git flow release [list] [-v]"
echo " git flow release start [-F] <version> [<base>]"
- echo " git flow release finish [-Fsumpk] <version>"
+ echo " git flow release finish [-Fsumpkb] <version>"
echo " git flow release publish <name>"
echo " git flow release track <name>"
}
@@ -193,6 +193,7 @@ cmd_finish() {
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
+ DEFINE_boolean nobackmerge false "don't back-merge $MASTER_BRANCH to be a parent of $DEVELOP_BRANCH (using tag if applicable)" b
parse_args "$@"
require_version_arg
@@ -245,17 +246,35 @@ cmd_finish() {
fi
# try to merge into develop
- # in case a previous attempt to finish this release branch has failed,
- # but the merge into develop was successful, we skip it now
- if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
- git checkout "$DEVELOP_BRANCH" || \
- die "Could not check out $DEVELOP_BRANCH."
-
- # TODO: Actually, accounting for 'git describe' pays, so we should
- # ideally git merge --no-ff $tagname here, instead!
- git merge --no-ff "$BRANCH" || \
- die "There were merge conflicts."
- # TODO: What do we do now?
+ if noflag nobackmerge; then
+ # in case a previous attempt to finish this release branch has failed,
+ # but the merge into develop was successful, we skip it now
+ if ! git_is_branch_merged_into "$MASTER_BRANCH" "$DEVELOP_BRANCH"; then
+ git checkout "$DEVELOP_BRANCH" || \
+ die "Could not check out $DEVELOP_BRANCH."
+
+ # merge the master branch back into develop; this makes the master
+ # branch - and the new tag (if provided) - a parent of the development
+ # branch, which in turn lets you use 'git describe' on either branch
+ if noflag notag; then
+ git merge --no-ff "$tagname" || \
+ die "There were merge conflicts."
+ else
+ git merge --no-ff "$MASTER_BRANCH" || \
+ die "There were merge conflicts."
+ fi
+ fi
+ else
+ # in case a previous attempt to finish this release branch has failed,
+ # but the merge into develop was successful, we skip it now
+ if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
+ git checkout "$DEVELOP_BRANCH" || \
+ die "Could not check out $DEVELOP_BRANCH."
+
+ # just merge the release branch into the development branch
+ git merge --no-ff "$BRANCH" || \
+ die "There were merge conflicts."
+ fi
fi
# delete branch
@@ -285,8 +304,15 @@ cmd_finish() {
echo "- Release branch has been merged into '$MASTER_BRANCH'"
if noflag notag; then
echo "- The release was tagged '$tagname'"
+ if noflag nobackmerge; then
+ echo "- Tag '$tagname' has been back-merged into '$DEVELOP_BRANCH'"
+ fi
+ fi
+ if flag nobackmerge; then
+ echo "- Release branch has been merged into '$DEVELOP_BRANCH'"
+ else
+ echo "- Branch '$MASTER_BRANCH' has been back-merged into '$DEVELOP_BRANCH'"
fi
- echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
if flag keep; then
echo "- Release branch '$BRANCH' is still available"
else
Something went wrong with that request. Please try again.