在硬重置之后,我是否可以恢复以下提交?
步骤:
1) $ (master) // ....made a bunch of changes to files thinking I was working on a branch
2) $ git checkout -b 001-branch // copy changes to a branch to work with
3) $ (001-branch) // make some more changes to files
4) $ (001-branch) git commit -a -m 'added and changed stuff'
// at this point I was just going to pull force master to latest then rebase my 001-branch off of original master (not the stuff I had modified)
5) $ (001-branch) git checkout master
6) $ (master) git reset --hard HEAD
7) $ (master) git pull
8) $ (master) git checkout 001-branch // go back to my branch and rebase my changes
9) $ (001-branch) // oops...my changes were all kiboshed and I don't see the commit I did per git lg
有没有办法从这个混乱中恢复我的更改?
git reflog
中看到了您的提交?reflog通常是解决此类问题的常见方法。 - Greg Hewgill