0

I read I can't git rebase --interactive anymore and other comments on the web. My repository seems just fine, I am on a branch, git log seems to match my expectations, ditto git status. I sometimes do an interactive rebase to get my work in progress commit to the head after merges, or to combine commits into better history. But it seems like I commonly start getting messages like this, followed by a success message.

$ git --version
git version 2.39.2 (Apple Git-143)

$ git status
On branch feat/WEB-8790-httpd-accounts-ui
Your branch is up to date with 'origin/feat/WEB-8790-httpd-accounts-ui'.

nothing to commit, working tree clean
$ git rebase -i 5adb675. # in editor reorder 1 commit
fatal: ref HEAD is not a symbolic ref
fatal: ref HEAD is not a symbolic ref
fatal: ref HEAD is not a symbolic ref
fatal: ref HEAD is not a symbolic ref
Successfully rebased and updated refs/heads/feat/WEB-8790-httpd-accounts-ui.

Nothing seems amiss, the commit history shows the rebased commits as rewritten (lg is an alias I use for log that formats more compressed listing)

$ git lg -5 
8470687 - 2023-06-30 (11 minutes ago) Marvin Greenberg: [WEB-8790] Initial work, wip
45d65a0 - 2023-07-20 (11 minutes ago) Marvin Greenberg: [WEB-8878] Fix typo
2725e07 - 2023-07-20 (11 minutes ago) Marvin Greenberg: [WEB-8878] standardize make targets
e2551f8 - 2023-07-17 (11 minutes ago) Marvin Greenberg: [WEB-8861] Add test script
5adb675 - 2023-07-18 (7 days ago) dev1: WEB-8607 merge from develop to get fixes.

Can someone explain the detached head fatal errors, and explain why the rebase is successful? Is there something I can do to fix this repository, although again it is not obviously broken?

Marvin
  • 2,537
  • 24
  • 35
  • 1
    Related / similar: ["fatal: ref HEAD is not a symbolic ref" during interactive git rebase](https://stackoverflow.com/q/18104923/11082165) – Brian61354270 Jul 25 '23 at 13:51
  • Yeah @Brian61354270 I saw that too, but it also seems to suggest that rebase is failing and there are visible problems. Mine seems to succeed. But good to have the ref here too. – Marvin Jul 25 '23 at 15:05

1 Answers1

1

Alright, this is operator error. I had looked at the ANSWERS on "fatal: ref HEAD is not a symbolic ref" during interactive git rebase, but after @brian61354270's comment, I reread all the comments on the question - and I'm sure the problem is in my hook scripts that I use to modify the commit comments.

That also explains why the rebase succeeds, because the error in the hook script doesn't cause the hook script to fail. So I have two things to fix.

Marvin
  • 2,537
  • 24
  • 35