Question

I'm following this guide to setup my git branches - http://nvie.com/posts/a-successful-git-branching-model/

I'm doing daily builds from the dev branch and tagging it with the version number. When we're ready for a release, I branch off of dev and merge it with the release branch. By doing so, I'm getting the individual commits from dev in the release branch. I want the release branches to only have one consolidated commit for that release.

e.g. dev branch has these commits -

[1.1.0.50] Individual Commit 
... 
[1.1.0.21] Individual Commit 
... 
...    
[1.0.0.4] Individual Commit 
[1.0.0.3] Individual Commit
[1.0.0.2] Individual Commit
[1.0.0.1] Individual Commit

And if 1.0.0.3 and 1.1.0.21 are released to production, I want the release branch to look like this omitting the individual commits -

[1.1.0.21] Consolidated commit
[1.0.0.3] Consolidated commit

How do I do this? Is this good practice? Am I missing something?

Was it helpful?

Solution

By doing so, I'm getting the individual commits from dev in the release branch

Probably because it is a fast-forward merge.

Simply do a:

git checkout release
git merge --no-ff yourDevBranch

And you will always have only one commit as a result of your merge (which can be problematic for git bisect though).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top