问题描述
在执行git rebase命令的时候通过Ctrl+C组合键中断rebase操作后,再次执行--contunue或--skip选项会出现如下提示:
error: could not read '.git/rebase-apply/head-name': No such file or directory
操作过程
- 第一步:
git rebase origin/master
- 第二步:快速按Ctrl+C组合键中断
- 第三步:执行
git rebase --contunue
或git rebase --skip
等出现错误提示。
以下是参考操作路径:
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider (master)
$ git rebase origin/master
First, rewinding head to replay your work on top of it...
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider ((aa1bd07...)|AM/REBASE)
$ git status
rebase in progress; onto (NULL)
You are currently rebasing.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider ((aa1bd07...)|AM/REBASE)
$ git checkout master
Previous HEAD position was aa1bd07 「黑暗料理」假蒟煎蛋 https://www.klavor.com/cooking/20200508-795.html Author : Klavor Lee Date : 2020-05-08 Category : cooking
Switched to branch 'master'
Your branch and 'origin/master' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider (master|AM/REBASE)
$ git log
commit ce6bf1b71cb731d08ef66432edbe58bd62d85512 (HEAD -> master)
Author: Klavor Lee <lee@klavor.com>
Date: Fri Jun 12 01:35:47 2020 +0800
dsfasdf
commit 13ef1b0206d0b1859574c01270c4dcba78dfe14d
Author: Klavor Lee <lee@klavor.com>
Date: Wed Nov 6 18:07:42 2019 +0800
「科学上网」Shadowsocks服务端快速搭建脚本使用教程
Url : https://www.klavor.com/dev/20191106-700.html
Author : Klavor Lee
Date : 2019-10-31
Category : dev
commit 17cc23aca3b8242eaf73444ff8f525f04d776b80
Author: Klavor Lee <lee@klavor.com>
Date: Fri Nov 1 12:27:22 2019 +0800
找工作
Url : https://www.klavor.com/essay/20191031-695.html
Author : Klavor Lee
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider (master|AM/REBASE)
$ git rebase origin/master
fatal: It seems that there is already a rebase-apply directory, and
I wonder if you are in the middle of another rebase. If that is the
case, please try
git rebase (--continue | --abort | --skip)
If that is not the case, please
rm -fr ".git/rebase-apply"
and run me again. I am stopping in case you still have something
valuable there.
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider (master|AM/REBASE)
$ git rebase --continue
error: could not read '.git/rebase-apply/head-name': No such file or directory
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider (master|AM/REBASE)
$ git rebase --skip
error: could not read '.git/rebase-apply/head-name': No such file or directory
Klavor@DESKTOP-I8SM701 MINGW64 ~/Workspace/blog-image-provider (master|AM/REBASE)
$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
You are currently rebasing.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean
解决办法
根据再次输入命令git rebase origin/master
后的提示,可知推荐的两种操作。
git rebase (--continue | --abort | --skip)
或
rm -fr ".git/rebase-apply"
但是,git rebase (--continue | --abort | --skip)
前面已经说过了,会出现error: could not read '.git/rebase-apply/head-name': No such file or directory
的异常提示。因此通过rm -fr ".git/rebase-apply"
将git rebase产生的中间文件删除即可。
删除后,重新再执行git rebase origin/master
即可正常完成rebase。
网友评论