所以我和一个朋友一直在做一个项目。大多数时候,合并是不痛苦的,因为我们通常在不同的领域工作。
最近,我们遇到了越来越多令人讨厌的合并(截止日期)。
因此,我们开始研究合并会有什么效果。我找到了一种使用git diff的方法:
git diff mybranch...hisbranch这会产生非常好的结果。问题是,由于它使用了最后一个公共祖先,并且祖先越来越远,合并中有很多垃圾,在我们的任何一个分支中都没有改变。
所以我想知道有没有一种方法可以准确地可视化合并会做什么。
我试过了:
git diff $(git-merge mybranch hisbranch) hisbranch这看起来不错,但我想以另一种方式可视化合并,所以我尝试了:
git diff $(git-merge hisbranch mybranch) mybranch但在这种情况下,git-merge: command not found
有没有人知道一个不错的方法来比较两个分支的差异,以显示合并会引入什么?也许会突出冲突?
如果没有,有什么可视化的工具可以让你手动提交,这样你就可以选择哪个版本的代码是最好的。
发布于 2012-07-31 04:31:14
还有其他方法可以可视化将要发生的事情,但我发现最简单的方法是git merge --no-commit。从手册页:
--commit, --no-commit
Perform the merge and commit the result. This option can be used to override --no-commit.
With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and further tweak the merge
result before committing.基本上,我只是发出git merge --no-commit <branch>命令并检查结果。如果我不喜欢它们,我会发出git merge --abort,或者如果我想提交合并,我会正常地使用git commit。
https://stackoverflow.com/questions/11727102
复制相似问题