3

Possible Duplicate:
Recover from git reset --hard?

I first used git add ., but it added some files I don't want to include in the repository.

So I ran git reset --hard HEAD before committing the changes. Is there a way to get these changes back?

Community
  • 1
  • 1
areslp
  • 383
  • 1
  • 4
  • 17
  • 5
    Not an obvious one that I know unfortunately - for future reference, use `git reset ` for this rather than `git reset --hard HEAD`, since the latter basically nukes your changes and resets your working copy to HEAD. See the man page here: http://www.kernel.org/pub/software/scm/git/docs/git-reset.html – Stuart Golodetz Nov 23 '12 at 01:52
  • 1
    Dupe: http://stackoverflow.com/q/5788037/422353 – madth3 Nov 23 '12 at 02:02
  • 1
    Not quite a dupe of what madth3 has (that question doesnt mention adding to the index before resetting) but an answer in that link does apply to your question http://stackoverflow.com/a/6780036/496405 – g19fanatic Nov 23 '12 at 04:13

1 Answers1

0

You don't. That's why I always recommend to use

git stash -u

to get the same effect but you can undo that action.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141