tags:

views:

58

answers:

1

I ran a git pull --rebase, and aborted this after fixing several merge-conflicts using git rebase --abort.

Before the attempted rebase, git status told me: "Your branch is ahead of 'origin/master' by 20 commits." Now I get: "Your branch and 'origin/master' have diverged, and have 15 and 5 different commit(s) each, respectively."

I have already done a reset to the latest commit (git reset --hard c15...e30), but the status message is still the same.

How do I revert my repository to the state is was before I started the mess? And what is the difference between the current state and the previous?

Thanks.

+2  A: 

The git rebase --abort should have taken you back to your original HEAD. I'm not sure what you meant by "fixing several merge-conflicts using ... abort". Did you mean --continue?

Anyway, the thing to do now is consult the reflog. The reflog is a local, temporal log of where all of your references have been. If you look at .git/logs/HEAD you can see where HEAD (the working set) has been. Under .git/logs/refs/... you can see where all of your branches (local and remote) have been. Each line in the log reflects some action. The starting SHA, ending, user, time, and a string describing what action caused the change. You can find the one you want and reset back to it.

Ben Jackson