忘记了“git rebase --continue”并做了“git commit”。怎么修? [英] Forgot "git rebase --continue" and did "git commit". How to fix?

查看:509
本文介绍了忘记了“git rebase --continue”并做了“git commit”。怎么修?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是在git中重新绑定代码,我遇到了一些合并冲突。我解决了冲突,并做到了:

I was rebasing code in git, I got some merge conflicts. I resolved the conflicts and did:

git add

此时我忘记了:

At this point I forgot to do:

git rebase --continue

我继续编写代码并做了:

I continued coding and did:

git commit

用于更改。现在我在no branch上,不能这样做:

for the changes. Now I am on "no branch" and can't do:

git rebase --continue 

如何解决这个问题?

How do I fix this?

推荐答案

这个答案是错误的,或者至少是非常糟糕的。改为使用其他解决方案。

我必须尝试一下,但我认为这是我应该做的:

I'd have to try it out, but I think this is what I would do:


  1. 标记您的最新提交(或者只是在某处写下它的SHA1,以免丢失它): git tag temp $ git rebase --abort

  2. 再次进行rebase。你将不得不再次解决合并。 :

  3. git rebase --continue

  4. git cherry -pick temp

  1. Tag your latest commit (or just write down its SHA1 somewhere so you don't lose it): git tag temp
  2. git rebase --abort
  3. Do the rebase again. You'll have to resolve the merge again. :(
  4. git rebase --continue
  5. git cherry-pick temp

问题在于您的 temp commit可能包含合并的分辨率和新的代码,所以它可能会非常棘手,但我会尝试一下,看看它是否有效。

The problem with this is that your temp commit probably contains both the resolution of the merge, and the new code. So it could be tricky but I would try it and see if it works.

这篇关于忘记了“git rebase --continue”并做了“git commit”。怎么修?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆