1

我正在按照本指南设置我的 git 分支 - http://nvie.com/posts/a-successful-git-branching-model/

我正在从 dev 分支进行日常构建,并用版本号标记它。当我们准备好发布时,我从 dev 分支出来并将其与发布分支合并。通过这样做,我从发布分支中的开发人员那里获得了个人提交。我希望发布分支对该版本只有一个合并提交。

例如 dev 分支有这些提交 -

[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

如果 1.0.0.3 和 1.1.0.21 发布到生产环境中,我希望发布分支看起来像这样,省略单个提交 -

[1.1.0.21] Consolidated commit
[1.0.0.3] Consolidated commit

我该怎么做呢?这是好习惯吗?我错过了什么吗?

4

1 回答 1

0

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).

于 2013-12-03T03:57:31.737 回答