合并或重新绑定任意数量的提交 [英] Combine or rebase an arbitrarily large number of commits
本文介绍了合并或重新绑定任意数量的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我的本地 git log
显示:
739b36d3a314483a2d4a14268612cd955c6af9fb a
...
c42fff47a257b72ab3fabaa0bcc2be9cd50d5c89 x
c4149ba120b30955a9285ed721b795cd2b82dd65 y
dce99bcc4b79622d2658208d2371ee490dff7d28 z
My remote git log
显示:
c4149ba120b30955a9285ed721b795cd2b82dd65 y
dce99bcc4b79622d2658208d2371ee490dff7d28 z
什么是最简单的方法(假设任意大本地提交次数):
527b5810cfd8f45f18ae807af1fe1e54a0312bce a ... x
c4149ba120b30955a9285ed721b795cd2b82dd65 y
一个选项是> git rebase -i @ {u}
。我经常使用它,我已经把它作为 git freebase
(因为它可以提交,你可以自由rebase )。 p>
如果您不熟悉, @ {u}
是 @ {上游}
或当前分支的上游。
Let's say my local git log
shows:
739b36d3a314483a2d4a14268612cd955c6af9fb a
...
c42fff47a257b72ab3fabaa0bcc2be9cd50d5c89 x
c4149ba120b30955a9285ed721b795cd2b82dd65 y
dce99bcc4b79622d2658208d2371ee490dff7d28 z
My remote git log
shows:
c4149ba120b30955a9285ed721b795cd2b82dd65 y
dce99bcc4b79622d2658208d2371ee490dff7d28 z
What's the easiest way to get to this (assuming an arbitrarily large number of local commits):
527b5810cfd8f45f18ae807af1fe1e54a0312bce a ... x
c4149ba120b30955a9285ed721b795cd2b82dd65 y
dce99bcc4b79622d2658208d2371ee490dff7d28 z
解决方案 One option is git rebase -i @{u}
. I use this frequently enough that I've aliased it as git freebase
(since it works on the commits that you can freely rebase).
In case you're not familiar, @{u}
is a shortcut for @{upstream}
, or "the upstream of the current branch".
这篇关于合并或重新绑定任意数量的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文