当我跑步时:

git status

我看到了这个:

rebase in progress; onto 9c168a5
You are currently rebasing branch 'master' on '9c168a5'.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working directory clean

当我这样做的时候:

ls `git rev-parse --git-dir` | grep rebase || echo no rebase

我明白了:rebase-apply

我不能确定起源。

git branch

显示:

* (no branch, rebasing master)
  develop
  master

我卡住了。我不知道该怎么办?真的需要这么长时间来调整基地吗?Git rebase—continue不做任何事情。我没有任何东西在git状态..我只是在等待重新调整。我该怎么办?

UDATE: 这是git rebase——continue的输出

Applying: no message
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

Git添加。无关。


当前回答

我最近也陷入了这种状态。在解决了rebase期间的冲突后,我提交了我的更改,而不是运行git rebase—continue。这将产生与运行git status和git rebase——continue命令时相同的消息。我通过运行git rebase -abort来解决这个问题,然后重新运行rebase。人们也可以跳过重基,但我不确定这会让我处于什么状态。

$ git rebase --continue
Applying: <commit message>
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

$ git status
rebase in progress; onto 4df0775
You are currently rebasing branch '<local-branch-name>' on '4df0775'.
  (all conflicts fixed: run "git rebase --continue")

nothing to commit, working directory clean

其他回答

如果git rebase -abort不工作,你仍然得到

错误:无法读取。git/rebase-apply/head-name':没有这样的文件或目录

类型:

git rebase --quit

我最近也陷入了这种状态。在解决了rebase期间的冲突后,我提交了我的更改,而不是运行git rebase—continue。这将产生与运行git status和git rebase——continue命令时相同的消息。我通过运行git rebase -abort来解决这个问题,然后重新运行rebase。人们也可以跳过重基,但我不确定这会让我处于什么状态。

$ git rebase --continue
Applying: <commit message>
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

$ git status
rebase in progress; onto 4df0775
You are currently rebasing branch '<local-branch-name>' on '4df0775'.
  (all conflicts fixed: run "git rebase --continue")

nothing to commit, working directory clean

我检查了HEAD基地的一个新分支。这工作。

我设置我的git自动rebase在一个git签出

# in my ~/.gitconfig file
[branch]
    autosetupmerge = always
    autosetuprebase = always

否则,当您在分支之间切换时,它会自动合并,我认为这是最糟糕的默认选择。

然而,这有一个副作用,当我切换到一个分支,然后git cherry-pick <commit-id>时,每次它有冲突时,我都会处于这种奇怪的状态。

我实际上必须中止rebase,但首先我修复了冲突,git添加/path/to/file文件(在这种情况下解决冲突的另一种非常奇怪的方式?!),然后执行git commit -i /path/to/file。现在我可以中止rebase:

git checkout <other-branch>
git cherry-pick <commit-id>
...edit-conflict(s)...
git add path/to/file
git commit -i path/to/file
git rebase --abort
git commit .
git push --force origin <other-branch>

第二个git提交。似乎来自中止计划。我将修正我的答案,如果我发现我应该早点放弃重新基地。

如果您跳过其他提交,并且两个分支都不顺利(两个分支都缺少来自另一个分支的提交),则需要在push上使用——force。

你告诉你的存储库要改基。看起来你是在提交(由SHA 9c168a5识别),然后git rebase master或git pull -rebase master。

你是在将分支master重新基于那个提交。你可以通过git rebase——abort来结束rebase。这会让你回到你开始变基之前的状态。