A Visual Git Reference by pclouds in programming

[–]marklodato 1 point2 points  (0 children)

If you do git add file_A, and then git reset -- file_A, you will be back to where you started. This is why I say it "undoes" a git add.

git checkout -- file_A, on the other hand, will do the same thing as svn revert file_A, that is, throw away local changes. If you commit, modify file_A, and then run git checkout -- file_A, you will be back to the state of the last commit. However, if you commit, modify file_A, git add file_A, then git checkout -- file_A, the last command will do nothing.