I can't git rebase --interactive anymore

谁都会走 提交于 2019-12-06 23:30:02

问题


I'm having a serious problem trying to do git rebase --interactive on my repo. I get the cryptic error fatal: ref HEAD is not a symbolic ref, and my rebase ceases to function. I must git rebase --abort to get back to a good state.

Here are the output(s) I receive: https://gist.github.com/d38f1e2d2ec9bc480b6f

What I've been told in the past is that this is due to the fact that I'm in "detached HEAD" mode, but how would I have gotten into the rebase in the first place if I was in that mode? I'm most certainly starting in master, then running git rebase --interactive and modifying the git-rebase-todo text file to what I want. And then this error happens.

I've asked everyone here at work, and some people @ #git on freenode. No one seems to truly understand my problem or know what the solution is. Googling for that error produced nothing, relevant searches on StackOverflow have proven nothing. I can't seem to figure this out, and it's really lame going from squashing every commit I push to master to now pushing every little change I make as its own separate commit.


回答1:


During a 'git rebase' the ref that you are rebasing off of is checked out. If that ref is a commit then you will get a detached head; if it is a branch reference then that branch is checked out. If during the course of a commit a FATAL occurs, then you are left with a working directory in a munged state. For example, if you were on branch Foo and you tried to rebase off of Bar, then after a FATAL you will be at Bar or somewhere after Bar with a few rebase commits applied. You recover by checking out Foo as simply.

git rebase --abort 

or, if the rebase is really wedged (see reference below), as:

git checkout -f Foo

After that, you can safely try the rebase again to try to debug why the FATAL occurs. Here is a case where rebase fails when running out of memory and 'git rebase --abort' doesn't work.



来源:https://stackoverflow.com/questions/10488655/i-cant-git-rebase-interactive-anymore

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