正在进行改革。无法提交。如何进行或停止(中止)?

问题描述 投票:91回答:7

当我跑:

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状态..我只是在等待rebase。我能做什么?

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 add。没什么。

git git-rebase
7个回答
187
投票

Rebase不会在后台发生。 “正在进行的改变”意味着你开始了一次变革,并且因为冲突而变质被打断了。你必须恢复rebase(git rebase --continue)或中止它(git rebase --abort)。

正如来自git rebase --continue的错误消息所示,您要求git应用一个导致空补丁的补丁。最有可能的是,这意味着补丁已经应用,你想使用git rebase --skip删除它。


5
投票

你告诉你的存储库要改变。看起来你正在提交(由SHA 9c168a5确定)然后做了git rebase mastergit pull --rebase master

您正在将分支主服务器重新定位到该提交上。你可以通过git rebase --abort结束rebase。这会在你开始变基之前回到你所处的状态。


4
投票

我最近进入了这个州。在rebase期间解决冲突后,我提交了我的更改,而不是运行git rebase --continue。这会产生您在运行git statusgit 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

2
投票
  • 第1步:继续前进git rebase --continue
  • 第2步:修复CONFLICTS然后git add .
  • 回到第1步,现在如果它说no changes ..然后运行git rebase --skip然后回到第1步
  • 如果你只是想退出rebase运行git rebase --abort
  • 完成所有更改后,运行git commit -m "rebase complete",您就完成了。

2
投票

我陷入了'变种状态',我得到了

On branch master
Your branch is up to date with 'origin/master'.

You are currently rebasing.
  (all conflicts fixed: run "git rebase --continue")

nothing to commit, working tree clean

但是运行git rebase --skip产生了error: could not read '.git/rebase-apply/head-name': No such file or directory

运行rm -fr ".git/rebase-apply"帮助。

注意:当然,只有当你不关心rebase或者你仍然不再需要之前的rebase时才这样做。


0
投票

我在git上设置我的git checkout到autorebase

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

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

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

我实际上必须中止rebase,但首先我解决冲突,git add /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 commit .似乎来自中止。如果我发现我应该早点中止rebase,我会解决我的问题。

如果你跳过其他提交并且两个分支都不平滑(两个都缺少来自另一个的提交),则需要推送上的--force


-1
投票

IDE的ABORT / SKIP / CONTINUE的另一个选项

VCS> Git> Abort Rebasing

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.