執(zhí)行g(shù)it rebase過程中斷后報(bào)No such file or directory錯(cuò)誤的問題解決方法.PNG
問題描述
在執(zhí)行g(shù)it rebase命令的時(shí)候通過Ctrl+C組合鍵中斷rebase操作后震嫉,再次執(zhí)行--contunue或--skip選項(xiàng)會(huì)出現(xiàn)如下提示:
error: could not read '.git/rebase-apply/head-name': No such file or directory
操作過程
- 第一步:
git rebase origin/master
- 第二步:快速按Ctrl+C組合鍵中斷
- 第三步:執(zhí)行
git rebase --contunue
或git rebase --skip
等出現(xiàn)錯(cuò)誤提示。
以下是參考操作路徑:
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
「科學(xué)上網(wǎng)」Shadowsocks服務(wù)端快速搭建腳本使用教程
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
解決辦法
根據(jù)再次輸入命令git rebase origin/master
后的提示重归,可知推薦的兩種操作。
git rebase (--continue | --abort | --skip)
或
rm -fr ".git/rebase-apply"
但是瞻想,git rebase (--continue | --abort | --skip)
前面已經(jīng)說過了蜕窿,會(huì)出現(xiàn)error: could not read '.git/rebase-apply/head-name': No such file or directory
的異常提示寂玲。因此通過rm -fr ".git/rebase-apply"
將git rebase產(chǎn)生的中間文件刪除即可。
刪除后冠摄,重新再執(zhí)行git rebase origin/master
即可正常完成rebase糯崎。