I made a mess on my branch after trying to rebase to the master.
In my commit history, I had quite a bit of refactoring (renaming and moving), along with deletion of classes. And I SHOULDN'T have pushed to the remote repository. (I know, I'm kicking myself ever since).
However, what's done is done. Now since the rebase rewrites the history and commits(?) (by the conflict resolving during the rebase), I can not reset to an earlier commit HEAD~2 to start over, all the commits were rewritten and with wrong commits.
I can get a snapshot of the HEAD~2 from git, is there way for me merge (rebase) the snapshot back to my branch, rollback the changes, and start over?
Thanks in advance!
David
Update, from our internal git web page, I can see the previous commit:
commit 6f577850231fed07eebdacd3bc5862f84356d803
tree 8be1d60056697bc1b8d7284c4e85a6d1738ac3e2 tree | snapshot
parent 1ca61d4dd69b7be649906834d44bb7fec390153d commit | diff
And I'm able to download a snapshot in gz by clicking the "snapshot" link. However, when I try to do:
git checkout -b newBranch 6f577850231fed07eebdacd3bc5862f84356d803
I got:
fatal: reference is not a tree: 6f577850231fed07eebdacd3bc5862f84356d803
If I run:
git checkout -b --force newBranch 6f577850231fed07eebdacd3bc5862f84356d803
I got:
fatal: git checkout: updating paths is incompatible with switching branches.
I guess this commit only resides on the remote repository? How can I checkout it out in git then?
Solution: This SO answer is the solution to my problem: Undoing a git rebase