Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 7 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
share|improve this answer
1  
git checkout is the way. –  Daniel Hershcovich Aug 7 '12 at 14:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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