2017-04-26 67 views
0

我创建了一个小功能的命名分支,现在我想合并到默认分支但不推送功能分支。Git的壁球合并Mercury等价

在git中,我可以做git merge --squash my-feature。 Mercurial中的等效物还有什么替代物?

回答

2

Git“壁球合并”根本不是合并。它使用合并机器来复制一堆其他提交的效果和合并基础查找机制以确定应用哪个差异,但是它只是将这些更改直接作为新的独立提交应用:

[email protected] <-- you-are-here 
     \ 
      Q--R--S <-- stuff-you-want-to-squash 

Git现在有效地做git diff B S | git apply -3

水银没有想象中的那么,但由于这副本的提交Q-R-S的影响,并将它们作为一个新的@提交后,您可以使用hg rebase。如果您想保留原始Q-R-S(或无论提交多少次提交)和--collapse选项以获得压扁效果,请参阅--keep选项。

+0

全部命令 '汞柱变基--keep --collapse -s commit_hash-of_first_commit_in_my_feature_branch -d default' 进一步阅读:https://spin.atomicobject.com/2013/11/27/move-unpushed-changes / – Krishnaraj