Git - How to fix “corrupted” interactive rebase?

拜拜、爱过 提交于 2019-11-28 17:20:47

It looks like Git tried to remove the .git/rebase-merge directory but wasn't able to remove it completely. Have you tried copying that folder away? Also copy away the .git/rebase-apply folder if that is present.

I had a similar problem due to a zombie vim.exe process. Killing it in Task Manager, followed by a git rebase --abort fixed it.

I got stuck in this. I created the head-name file, and then I ran into another error saying it couldn't find the onto file, so I created that file. Then I got another error saying could not read '.git/rebase-apply/onto': No such file or directory.

So I looked at the git documentation for rebasing and found another command called git rebase --quit. This set me back on my branch with no changes, and I could start my rebase over again, good as new.

Had same problem in Eclipse. Could not Rebase=>abort from Eclipse.

Executing git rebase --abort from Git Bash Worked for me.

On Windows, if you are unwilling or unable to restart the machine see below.

Install Process Explorer: https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

In Process Explorer, Find > File Handle or DLL ...

Type in the file name mentioned in the error (for my error it was 'git-rebase-todo' but in the question above, 'done').

Process Explorer will highlight the process holding a lock on the file (for me it was 'grep').

Kill the process and you will be able to abort the git action in the standard way.

Tehila Dabush

Create a file with this name:

touch .git/rebase-merge/head-name

and than use git rebase

In my case eighter git rebase --abort and git rebase --continue was throwing:

error: could not read '.git/rebase-apply/head-name': No such file or directory

I managed to fix this issue by manually removing: .git\rebase-apply directory.

Thanks @Laura Slocum for your answer

I messed things up while rebasing and got a detached HEAD with an

 error: could not read orig-head

that prevented me from finishing the rebasing.

The detached HEAD seem to contain precisely my correct rebase desired state, so I ran

rebase --quit

and after that I checked out a new temp branch to bind it to the detached head.

By comparing it with the branch I wanted to rebase, I can see the new temp branch is exactly in the state I wanted to reach. Thanks

In my case it was because I had opened SmartGit's Log in the respective Git project and Total Commander in the respective project directory. When I closed both I was able to rebase without any problem.

The more I think about it, the more I suspect Total Commander, i.e. Windows having a lock on opened directory the git rebase was trying to something with.

Friendly advice: When you try to fix something, always do one change at a time. ;)

I'm using git version 2.19.2.windows.1.

the only thing that worked for me was to remove the .git/rebase-apply/ directory and do a git reset --hard.

With SublimeText 3 on Windows, the problem is fixed by just closing the Sublime windows used for interactive commit edition.

diptia

Once you have satisfactorily completed rebasing X number of commits , the last command must be git rebase --continue . That completes the process and exits out of the rebase mode .

I had the same problem. I used process explorer as suggested in other post (i am not able to find that post) and figured out which process has a lock on the file and kill it. then execute the --continue or --abort as per needs

In my case after testing all this options and still having issues i tried sudo git rebase --abort and it did the whole thing

I have tried all the above steps mentioned but nothing worked for me. Finally, restarting the computer worked for this issue :D

tried everything else but a reboot, what worked for me is rm -fr .git/REBASE_HEAD

I am using git in eclipse and I was having the same problem.

Eventually I found that the "Rebase ..." menu entry was temporarily transformed into a sub-menu.

Team-> Rebase -> Abort

It worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!