Let's say I've staged a file, and then I'm working on that file and want to abandon those changes and pull the copy down from the stage again.

How do I do that?

I tried git reset HEAD but for some reason it unstages the file and keeps my changes in the working dir.

link|improve this question

77% accept rate
feedback

1 Answer

up vote 3 down vote accepted
git init; echo A>A; git add A; git commit -m A; echo AA>>A; git add A; echo AAA>>A
git diff A | patch -R -p1

There is probably an easier way, but this works.

And so there is:

git show :A > A

Even easier. I assumed this got it from HEAD, but I was wrong there.

git checkout A
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.