2

There are many questions about git, so I google for a while before I asked here. I've not find any useful info.

Just make it easy,

cat a.txt >> c.txt
git add .
cat b.txt >> c.txt

how to undo the last cat command.

Note here is just a simple to illustrate what I want, there are lot of modify before and after the git add.

The question may be duplicate, or the title is not proper, may someone helps?

Mouloud88
  • 3,438
  • 4
  • 18
  • 41
LF00
  • 24,667
  • 25
  • 136
  • 263
  • 1
    Basically, `git checkout c.txt` will reset `c.txt` to its state in the index, which is the state you added when you did `git add .`. – poke Dec 07 '16 at 08:04
  • http://stackoverflow.com/q/52704/6521116 http://stackoverflow.com/a/52713/6521116 – LF00 May 10 '17 at 02:17
  • 1
    The question is asking how to discard STAGED changes (i.e. he did a git add). The reference to the "duplicate" addresses the question of UNSTAGED (that are "not in the index") changes. I agree that this question is a duplicate, but to this question: https://stackoverflow.com/questions/19730565/ and not to the link posted by poke. – Michael Szczepaniak Jun 06 '17 at 23:29

0 Answers0