GNU Emacs Manual. Node: VC Undo

PREVVC Status UPSecondary VC Commands NEXTVC Dired Mode

12.7.5.3: Undoing Version Control Actions

C-x v u

Revert the buffer and the file to the last checked-in version.

C-x v c

Remove the last-entered change from the master for the visited file. This undoes your last check-in.

If you want to discard your current set of changes and revert to the last version checked in, use C-x v u (vc-revert-buffer). This leaves the file unlocked; if locking is in use, you must first lock the file again before you change it again. C-x v u requires confirmation, unless it sees that you haven't made any changes since the last checked-in version.

C-x v u is also the command to unlock a file if you lock it and then decide not to change it.

To cancel a change that you already checked in, use C-x v c (vc-cancel-version). This command discards all record of the most recent checked-in version. C-x v c also offers to revert your work file and buffer to the previous version (the one that precedes the version that is deleted).

If you answer no, VC keeps your changes in the buffer, and locks the file. The no-revert option is useful when you have checked in a change and then discover a trivial error in it; you can cancel the erroneous check-in, fix the error, and check the file in again.

When C-x v c does not revert the buffer, it unexpands all version control headers in the buffer instead (see Version Headers). This is because the buffer no longer corresponds to any existing version. If you check it in again, the check-in process will expand the headers properly for the new version number.

However, it is impossible to unexpand the RCS `$Log$' header automatically. If you use that header feature, you have to unexpand it by hand---by deleting the entry for the version that you just canceled.

Be careful when invoking C-x v c, as it is easy to lose a lot of work with it. To help you be careful, this command always requires confirmation with yes. Note also that this command is disabled under CVS, because canceling versions is very dangerous and discouraged with CVS.

PREVVC Status UPSecondary VC Commands NEXTVC Dired Mode