我在用着git rebase -i
重写历史记录 - 在这种情况下,对早期提交的更改集进行小的更改。换句话说,
A---B---C master
--->
A---B'--C master
I know C
也在隐含地改变,但你明白了。这是我迄今为止的进展:
git rebase -i HEAD~2
- Change
B
from keep
to edit
.
- 编辑文件。
git commit -a --amend
git rebase --continue
- “无法应用 [C]...”
我已经解决了冲突的行C
,但我不确定如何将其标记为已解决,以便变基可以继续。git commit --amend
尝试修改B
, while git rebase --continue
抱怨工作树很脏。 (而且,果然,git status
将文件显示为“均已修改”。)
我需要做什么才能让这个变基重回正轨?
当您遇到冲突时,您应该会看到类似以下内容的消息:
error: could not apply 45cb26a... <commit message subject>
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' and run 'git rebase --continue'
这正是您需要做的:
# resolve the conflicts somehow
git add <conflicted-file>
git rebase --continue
不要尝试使用commit --amend
. HEAD
(当前提交)仍然指的是之前的提交,因为冲突阻止了这一提交的进行,所以正如您所看到的,这只是修改了已经应用的提交。rebase --continue
将继续进行包含已解决冲突的新提交。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)