0

Git documentation about the revert subcommand of git add -i:

revert
This has a very similar UI to update, and the staged information for selected paths are reverted to that of the HEAD version.

Maybe I incorrectly understand this text... I understand this like:

revert does the same like git checkout -- file_name.

But at practice I see revert only removes file from the staging area. Did I incorrect translat, or it is incorrect text in the documentation?

Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182

1 Answers1

0

There is a difference between the subcommand revert (on interactive mode) the command revert and command reset.

  • The first one is the opposite of git add, and you will able to use only if you run git add --interactive
  • The second one is used to revert commits (will add a new commit with the opposite operations of the reverted commit).
  • The last one is like the git add subcommand revert (first one), I mean, undo git add command (unless you specify a commit, see documentation).

So if you want to really reset some file you have to use git checkout -- HEAD filename


From Documentation:

Git Revert

Git Reset

Git CheckOut

mayo
  • 3,845
  • 1
  • 32
  • 42