撤消git rebase --skip-在rebase期间重新应用提交 [英] Undoing a git rebase --skip - reapply a commit during a rebase
问题描述
我正在做很多提交的很长的git rebase
.我不小心--skipped
提交了一些我解决了的冲突.我应该做git rebase --continue
.
I'm doing a long git rebase
with a lot of commits. I accidentally --skipped
a commit where there were some conflicts which I resolved. I should have done git rebase --continue
.
在重新设置基准的阶段,是否有办法重新应用此先前的提交,然后继续重新确定基准?
Is there are way to re-apply this previous commit during this rebase phase and then continue the rebase?
我看到的一种方法是
- 通过在最后一次正确应用的提交上创建一个分支,在此时停止变基
- 从先前跳过的提交开始重新启动基准.
或者在重设阶段时我可以做点樱桃选吗?
Or can I do a cherry-pick whilst being in a rebase-phase?
推荐答案
我找到了一种为我工作"的方法:
I found a way which "worked for me":
在重新设置基准期间,.git/rebase-apply
目录中发生了很多事情.除其他外,还有一个名为next
的文件. next
包含一个数字,该数字也对应于驻留在.git/rebase-apply
中的文件.该文件包含有关当前正在处理的提交的信息.例如:
During a rebase lots of things are happening in the .git/rebase-apply
directory. Amongst others there is a file called next
. next
is containing a number which corresponds to a file which is residing in the .git/rebase-apply
as well. This file contains information about the commit which is currently being processed. For example:
$ cat .git/rebase-apply/next
0260
$ less .git/rebase-apply/0260
<info about the commit which is currently processed (and has conflicts)
Git似乎保留了作为上述文件被跳过的提交.而与已提交的提交相对应的文件不再存在.我不小心跳过的提交称为0259,文件仍然存在.
Git seems to keep the commits which are skipped as the above mentioned files. Whereas files corresponding to commits which have been applied are not there anymore. The commit I accidentally skipped was called 0259 and the file was still present.
这是我所做的:
$ echo "0258" > .git/rebase-apply/next
这样,我告诉git当前正在处理第258次提交(先前已正确应用).然后我做到了
With that I told git that currently the 258th commit is processed (which previous applied correctly). Then I did
$ git rebase --skip
告诉git忘记这一步,瞧,我可以再次处理跳过的提交,更正冲突,然后按--continue
.它奏效了.
to tell git to forget this one and, voila, I could again work on the skipped commit, correct the conflicts and --continue
. It has worked.
这篇关于撤消git rebase --skip-在rebase期间重新应用提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!