In the magit from spacemacs, when I press O on a commit, it shows several actions, two of them are "revert commit" and "revert change", what's the difference between them?
1 Answer
According to the magit documentation, Revert changes
does the following:
Revert COMMIT by applying it in reverse to the worktree. Prompt for a commit, defaulting to the commit at point. If the region selects multiple commits, then revert all of them, without prompting.
The git
command that it runs under the hood is git revert --no-commit COMMIT
where COMMIT
is the commit you selected.
As for Revert commit(s)
:
Revert COMMIT by creating a new commit. Prompt for a commit, defaulting to the commit at point. If the region selects multiple commits, then revert all of them, without prompting.
For this, the git
command that gets run is git revert COMMIT
.
In other words, reverting changes puts the changes from the selected commit back in the working tree for you to do what you want with (including commit again), while reverting a commit will undo the changes from the selected commit and create a new commit (i.e., a new commit where those changes have been undone).
Also, whenever you see options in a magit popup, you can hit ?
and then the key associated with an option to see the documentation for that option.