我在重新绑定代码,我有一些合并冲突。我解决了冲突并做了“git add”。此时我忘了做“git rebase --continue”。我继续编写代码并为这些更改做了“git commit”。现在我在“没有分支”,现在不能做“git rebase - continueue”。我该如何解决?忘记“git rebase --continue”并做了“git commit”。怎么修?
回答
我不得不尝试一下,但我认为这是我会做什么:
- 标签的最新提交(或只写了它的SHA1的地方,这样你就不会失去它):
git tag temp
git rebase --abort
- 再次进行rebase。你将不得不再次解决合并。 :(
git rebase --continue
git cherry-pick temp
这样做的问题是,你的temp
承诺可能包含合并双方的分辨率,并将新的代码,因此它可能会非常棘手,但我会尝试,看看它是否工作。
你可以像@MatrixFrog说的标签,或者你也可以将它作为补丁保存。然后,重做中止。检查状态以确保回购处于您知道没有问题的状态,然后开始提取和重新分配。 – yasouser
不要这样做。请参阅下面的kirikaza的答案,以获得更简单/更清洁的方式。不要惹恼挑选和第二次解决冲突。 – tandrewnichols
@Ahhilash请接受kirikaza的回答。我(和tandrewnichols一样)做到了这一点,并且有一个更简单的方法(和互联网似乎同意,因为答案有4倍upvotes)。 –
只是做git reset --soft HEAD^
。它移动头指针其父但保持工作的树,并增加了合并更改索引。所以,你可以继续像以前一样git rebase --continue
基础重建。
- 1. 忘记了git rebase - 继续
- 2. GIT我该怎么做 - 所有冲突修复:运行“git rebase -continue”
- 3. 如果我在合并之前忘记做git svn rebase,该怎么办?
- 4. git存储,git apply,修改,git commit,git pop(首选rebase)?
- 5. Git rebase to older commit
- 6. 如何禁止`git rebase --continue`编辑器?
- 7. Git合并后git rebase?
- 8. git rebase,我想我做错了什么
- 9. 在rebase后撤销git commit
- 10. 什么git挂钩适用于'git rebase --continue'?
- 11. git rebase i vs git rebase --onto
- 12. 什么做“git checkout \ *”和“git commit - ”完成?
- 13. git rebase,“会被覆盖”,“没有变化 - 你忘了使用'git add'吗?”
- 14. `git svn rebase` vs`git rebase trunk`
- 15. Git - 合并vs rebase
- 16. 被遗忘的rebase互动 - git
- 17. git branches rebase after rebase
- 18. git rebase auto可以做git fetch吗?
- 19. 让git忘记我对文件做了任何事
- 20. git rebase interactive:squash merge commit在一起
- 21. git:使用“commit --cleanup = whitespace”和“rebase --interactive”
- 22. git rebase vs git rebase <upstream>
- 23. 我为什么要做git rebase?
- 24. git pull --rebase --ff-only会做什么?
- 25. 如何用git gui做rebase?
- 26. git合并VS rebase使用git svn
- 27. git rebase修复冲突后
- 28. git commit -m vs git commit -am
- 29. git pull VS git fetch git rebase
- 30. git:我在提示中得到了“am/rebase”,该怎么办?
'git status'说什么? – hvgotcodes
#目前不在任何分支。 没有提交(工作目录清洁) – Abhilash