Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .