29.1.8 Undoing Version Control Actions

C-x v u

Revert the work file(s) in the current VC fileset to the last revision (vc-revert).

If you want to discard all the changes you have made to the current VC fileset, type C-x v u (vc-revert). This will ask you for confirmation before discarding the changes. If you agree, the fileset is reverted.

If vc-revert-show-diff is non-nil, this command will show you a diff between the work file(s) and the revision from which you started editing. Afterwards, the diff buffer will either be killed (if this variable is kill), or the buffer will be buried (any other non-nil value). If you don’t want C-x v u to show a diff, set this variable to nil (you can still view the diff directly with C-x v =; see Examining And Comparing Old Revisions).

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.