Is there a way to issue the command:
git checkout NameOfFile
on a modified and unstaged file from within MAGIT?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
You can use one of the below to discard changes in unstaged files:
M-x magit-revert-item(bound to
M-x magit-discard-item(bound to
magit-status-mode) - works on staged items too
Using either method will ask you to confirm before discarding.
Reversing, reverting and discarding are distinct actions. Together with staging and unstaging, they are referred to as "apply variants".
To discard a change means to throw it away. Only un-committed changes can be discarded. When a staged change is discarded it is not only removed from the index (that is known as unstaging), but also from the work tree.
To reverse a change means to apply it to the work tree in reverse. Both committed and merely staged changes can be reversed. (Reversing staged changes is actually useful, i.e. when splitting up a commit).
Only commits can be reverted, in other regards it's similar to reversing.
See https://github.com/magit/magit/wiki/History-Manipulation for details.