"fatal: ref HEAD is not a symbolic ref" during interactive git rebase -
got 3 commits - 1 proper, , 2 silly cleanup ones, typos etc. want squash them. fire away:
git rebase -i head~3
sounds simple, , should work - i've tried after running problem, in brand new repo, , works expected. editor shows 3 commits, pick top, squash other two, save , quit, done. if run in verbose mode, see more details - git enters detached head state checking out 1st commit 'picked', 'rebasing 2/3' , 'rebasing 3/3', apparently creating temp commits along way -- , success message; editor pops again @ point, offering me change commit message. all's good.
but same command dies in work repo! 3 commits in editor, pick-squash-squash.. time, don't see 'rebasing 2/3', instead first line after 'head @ my-sha-1', runs fatal!
head @ 48a6c3d... <commit message> fatal: ref head not symbolic ref
but why would git expect head symbolic ref? rebase process detach head - same see in exploratory example - why fatal in second example, not in first one? cat .git/head give me sha1 of commit i've 'picked'...
i've spend several hours reading , researching, something's not right here, , cant find it! suspect maybe hooks responsible (know little them, , know problematic repo have some). thank consideration in answering this!
your "work" repo broken somehow. see i can't git rebase --interactive anymore details.
i'd try running git status
in work repo figure out going on. e.g. git rebase --abort
, git merge --abort
or may required.
i'd run git fsck
, too.
after repo , working directory go, interactive rebase should work fine. note may need git rebase --root --preserve-merges ...
in case want touch first commit in repo.
Comments
Post a Comment