Recovering a git reset --soft

kriver picture kriver · Jan 4, 2011 · Viewed 8.8k times · Source

I modified some files in my branch and did a

git add --all

But this added some files that I didn't intend to add for the commit.

So I did a

git reset --soft HEAD~2 (instead of doing git reset HEAD)

But the previous commit was made by someone else and it caused a lot of files to be in modified/added/deleted status. Is there a way to get back to a stage where the only changes I see are the files added/modified by me? Since I didnt make an actual commit, is there a way to move my head back to master without blowing away my changes? git pull is causing merge conflicts as I didn't actually commit my changes.

Thanks!

Answer

Kzqai picture Kzqai · Jan 4, 2011

For future reference, you can review the commits that your behavior causes or leaves behind by calling git reflog , which will include commits that are no longer in your working tree.