0

My understanding is that Sourcetree and Git Bash are just UI (view) looking at the same model (git repo status). So they should show the same state (after I refresh, that is).

But I just did a rebase -i through SourceTree, and perhaps some wrong operations, now I have the two UI reporting different states:

  1. Sourcetree (and Eclise Egit, too) thought my repo is clean and I could even checkout different branches at will

  2. Git Bash thought I am still in the middle of an interactive rebase and show the state as (where foo is a certain branch)

    (foo|REBASE-i 1/1)

When I did rebase --continue in Git Bash, I got these errors:

$ git rebase --continue
error: update_ref failed for ref 'refs/heads/foo': cannot lock ref 'refs/heads/foo': is at 70b13393524028fbeb15b853b3d058f6802f961b but expected 827b12fb1ddb5599e744d0bc07ec831d1ef0c843
error: could not update refs/heads/foo

How can this be possible?

How can I bail out?

Thanks!

leeyuiwah
  • 6,562
  • 8
  • 41
  • 71

1 Answers1

0

I am providing my own answer here.

For the same error (but maybe different causes), there is a popular way to solve the problem by running

git gc --prunce=now

See this SO answer

But this did not solve my problem.

Finally, I power-cycled my machine and then ran

git rebase --abort

And then the problem went away. I think what happened was that there were some dead process hold on to some file-system object and that prevented the git rebase --abort from working correctly before the power cycle.

However, at the end I still do not understand why Sourcetree (and Eclipse/Egit and Git GUI) would report a different state from Git bash (apparently it was the latter who was reporting a wrong state).

leeyuiwah
  • 6,562
  • 8
  • 41
  • 71