'Error when Git rebase --quit, --continue, and --abort
I'm trying to rebase my QA branch to main branch, and it was asking me to resolve the conflicts. There were some issues that I needed to solve first so I did git rebase --abort. then I tried to continue with git rebase --continue but failed with errors. Then I also try git rebase --quit and git rebase --abort but also had errors. Anyone knows what was wrong with it? Thank you in advance!
PS C:\Users\Desktop\SDP-React> git rebase --abort
warning: could not read '.git/rebase-merge/head-name': No such file or directory
PS C:\Users\Desktop\SDP-React> git rebase --quit
Deletion of directory '.git/rebase-merge' failed. Should I try again? (y/n) n
error: could not remove '.git/rebase-merge'
PS C:\Users\Desktop\SDP-React> git rebase main
fatal: It seems that there is already a rebase-merge 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-merge"
and run me again. I am stopping in case you still have something
valuable there.
PS C:\Users\Desktop\SDP-React> git rebase --continue
warning: could not read '.git/rebase-merge/head-name': No such file or directory
PS C:\Users\Desktop\SDP-React> git rebase main
fatal: It seems that there is already a rebase-merge 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-merge"
and run me again. I am stopping in case you still have something
valuable there.
Solution 1:[1]
If there is noting in .git/rebase-merge, your safe bet is to delete that folder, and reset --hard your repository, to go back to a state before the rebase.
Then you can try the rebase again, and resolve conflicts again.
Note: the .git folder itself is hidden, so you need to configure your Windows File Explorer to display "Hidden items".
Once the folder is deleted, a new rebase can indeed take place, as the OP Thi Nguyen confirms in the comments.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
