Go to the first, previous, next, last section, table of contents.

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 checkin.

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 cancels your last check-out, leaving the file unlocked. If you want to make a different set of changes, you must first check the file out 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 use to unlock a file if you lock it and then decide not to change it.

You can cancel a change after checking it in, with 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 say no, then 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 section Inserting Version Control Headers). This is because the buffer no longer corresponds to any existing version. If you check it in again, the checkin 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 throw away 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 this back end.


Go to the first, previous, next, last section, table of contents.