Revert the work file(s) in the current VC fileset to the last revision
If you want to discard all the changes you have made to the current
VC fileset, type C-x v u (
vc-revert-buffer). This shows
you a diff between the work file(s) and the revision from which you
started editing, and asks for confirmation for discarding the changes.
If you agree, the fileset is reverted. If you don’t want C-x v
u to show a diff, set the variable
nil (you can still view the diff directly with C-x v =;
see Old Revisions). Note that C-x v u cannot be reversed
with the usual undo commands (see Undo), so use it with care.
On locking-based version control systems, C-x v u leaves files unlocked; you must lock again to resume editing. You can also use C-x v u to unlock a file if you lock it and then decide not to change it.