On Sun, 28 Apr 2013 23:15:57 -0700 (PDT)
Thomas Ferris Nicolaisen <tfn...@gmail.com> wrote:

> > I commit a change to my local git repos, but I did a git hard
> > --reset local_commit^, and then my local changes disappeared, how
> > could I recover my local changes ? 
> You can recover previous commits (even if you left them behind using
> a reset) by looking in the "reflog". 
> http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html 

Alternatively, when you *just* did `git reset --hard` and got that
"oops!" feeling, the quick way to revert back is

git reset --hard ORIG_HEAD

because that "ORIG_HEAD" ref is updated each time the HEAD is updated
in a non-linear way (that is, not by promoting it as a result of
recording a new commit on a branch it points to).

Also note that the reflog (or ORIG_HEAD ref) is able to bring your last
commit to the life but any changes in your work tree and the index,
that is, everything which wasn't committed, are lost permanently.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to