30.1.7 VC Change Log

C-x v l

Display the change history for the current fileset (vc-print-log).

C-x v L

Display the change history for the current repository (vc-print-root-log).

C-u 1 C-x v L revision RET

Display the log entry and changes (diffs) of a single revision (vc-print-root-log).

C-x v b l

Display the change history for the current fileset on another branch (vc-print-fileset-branch-log).

C-x v b L

Display the change history for the current repository on another branch (vc-print-root-branch-log).

C-x v I

Display log entries for the changes that a “pull” operation will retrieve (vc-log-incoming).

If you customize vc-use-incoming-outgoing-prefixes to non-nil, C-x v I becomes a prefix key, and vc-log-incoming becomes bound to C-x v I L.

M-x vc-root-diff-incoming

Display a diff of all changes that a pull operation will retrieve.

If you customize vc-use-incoming-outgoing-prefixes to non-nil, this command becomes available on C-x v I D.

M-x vc-diff-incoming

Display a diff of changes that a pull operation will retrieve, but limited to the current fileset.

If you customize vc-use-incoming-outgoing-prefixes to non-nil, this command becomes available on C-x v I =.

C-x v O

Display log entries for the changes that will be sent by the next “push” operation (vc-log-outgoing).

If you customize vc-use-incoming-outgoing-prefixes to non-nil, C-x v O becomes a prefix key, and vc-log-outgoing becomes bound to C-x v O L.

M-x vc-root-diff-outgoing

Display a diff of all changes that will be sent by the next push operation.

If you customize vc-use-incoming-outgoing-prefixes to non-nil, this command is bound to C-x v O D.

M-x vc-diff-outgoing

Display a diff of changes that will be sent by the next push operation, but limited to the current fileset.

If you customize vc-use-incoming-outgoing-prefixes to non-nil, this command becomes available on C-x v O =.

C-x v h

Display the history of changes made in the region of file visited by the current buffer (vc-region-history).

M-x vc-log-search RET

Search the change history for a specified pattern.

C-x v l (vc-print-log) displays a buffer named *vc-change-log*, showing the history of changes made to the current fileset in the long form, including who made the changes, the dates, and the log entry for each change (these are the same log entries you would enter via the *vc-log* buffer; see Features of the Log Entry Buffer). If invoked from a buffer visiting a file, the current fileset consists of that single file, and point in the displayed *vc-change-log* buffer is centered at the revision of that file. If invoked from a VC Directory buffer (see VC Directory Mode) or from a Dired buffer (see Dired, the Directory Editor), the fileset consists of all the marked files, defaulting to the file shown on the current line in the directory buffer if no file is marked.

If the fileset includes one or more directories, the resulting *vc-change-log* buffer shows a short log of changes (one line for each change), if the VC backend supports that; otherwise it shows the log in the long form.

With a prefix argument, the command prompts for the revision to center on in the *vc-change-log* buffer and for the maximum number of revisions to display.

C-x v L (vc-print-root-log) displays a *vc-change-log* buffer showing the history of the entire version-controlled directory tree (RCS, SCCS, CVS, and SRC do not support this feature). With a prefix argument, the command prompts for the maximum number of revisions to display. A numeric prefix argument specifies the maximum number of revisions without prompting.

If the numeric prefix argument is 1, as in C-1 C-x v L or C-u 1 C-x v L, the command prompts for the revision ID, and displays the log entry of that revision together with the changes (diffs) it introduced. (Some less capable version control systems, such as RCS and CVS, don’t have commands to show a revision log with its diffs; for them the command displays only the log entry, and you can request to show the diffs by typing d or D, see below.)

The C-x v L history is shown in a compact form, usually showing only the first line of each log entry. However, you can type RET (log-view-toggle-entry-display) in the *vc-change-log* buffer to reveal the entire log entry for the revision at point. A second RET hides it again.

C-x v b l branch-name RET (vc-print-fileset-branch-log) displays a *vc-change-log* buffer showing the history of changes made to the current fileset in the long form, like vc-print-log does, but it shows the history of a branch other than the current one; it prompts for the name of the branch whose history you would like to see. C-x v b L branch-name RET (vc-print-root-branch-log) is similar except that it shows the history of the version-controlled directory tree, like vc-print-root-log.

For a version control system for which it makes sense, you can also specify a revision ID instead of the name of a branch as branch-name, and Emacs will print a log starting from that revision ID. You can also specify other names for specific revisions supported by the VCS, such as the names of tags (see Revision Tags), or the remote branch references supported by Git.

On a decentralized version control system, the C-x v I (vc-log-incoming) command displays a log buffer showing the changes that will be applied the next time you run the version control system’s pull command to get new revisions from another remote location (see Pulling/Pushing Changes into/from a Branch). This other remote location is the default one from which changes are pulled, as defined by the version control system; with a prefix argument, vc-log-incoming prompts for a particular remote location. Similarly, C-x v O (vc-log-outgoing) shows the changes that will be sent to another remote location, the next time you run the push command; with a prefix argument, it prompts for a particular destination that in case of some version control system can be a branch name.

The closely related commands vc-root-diff-incoming and vc-root-diff-outgoing are the diff analogues of vc-log-incoming and vc-log-outgoing. These display diff buffers reporting the changes that would be pulled or pushed. You can use a prefix argument here too to specify a particular remote location. vc-root-diff-outgoing is useful as a way to preview your push and quickly check that all and only the changes you intended to include were committed and will be pushed.

The commands vc-diff-incoming and vc-diff-outgoing are very similar. They also display changes that would be pulled or pushed. The difference is that the diffs reported are limited to the current fileset. Don’t forget that actual pull and push operations always affect the whole working tree, not just the current fileset.

In the *vc-change-log* buffer, you can use the following keys to move between the logs of revisions and of files, and to examine and compare past revisions (see Examining And Comparing Old Revisions):

p

Move to the previous revision entry (log-view-msg-prev). (Revision entries in the log buffer are usually in reverse-chronological order, so the previous revision-item usually corresponds to a newer revision.) A numeric prefix argument is a repeat count.

n

Move to the next revision entry (log-view-msg-next). A numeric prefix argument is a repeat count.

a

Annotate the revision on the current line (log-view-annotate-version; see Examining And Comparing Old Revisions).

e

Modify the change comment displayed at point (log-view-modify-change-comment). Note that not all VC systems support modifying change comments.

f

Visit the revision indicated at the current line (log-view-find-revision).

d

Display a diff between the revision at point and the next earlier revision, for the specific file (log-view-diff).

D

Display the changeset diff between the revision at point and the next earlier revision (log-view-diff-changeset). This shows the changes to all files made in that revision.

w

Copy to the kill ring (see The Kill Ring) the revision ID of the log entry at point, as if you had used M-w (log-view-copy-revision-as-kill). If several revisions are marked, the command copies to the kill ring the IDs of all of them, separated by spaces.

RET

In a compact-style log buffer (e.g., the one created by C-x v L), toggle between showing and hiding the full log entry for the revision at point (log-view-toggle-entry-display).

M-RET

Show the full log entry like RET does, if relevant, and also display the diff like D does, but without selecting the window showing the diff (log-view-display-entry-and-diff). Never hides the full log entry text if it is already shown.

M-p

Like p followed by M-RET: move to the previous entry, display it in full if relevant, and display its diff (log-view-msg-and-diff-prev). A numeric prefix argument is a repeat count for the movement part; at most one entry is displayed in full.

M-n

Like n followed by M-RET: move to the previous entry, display it in full if relevant, and display its diff (log-view-msg-and-diff-next). A numeric prefix argument is a repeat count for the movement part; at most one entry is displayed in full.

m

Mark the entry at point (log-view-mark-entry).

u

Unmark the entry at point (log-view-unmark-entry).

U

Unmark all marked entries (log-view-unmark-all-entries).

C

Copy changes to a currently checked out branch; either the changes from the revision at point, or the changes from all marked revisions (log-view-cherry-pick).

R

Undo the effects of old revisions; either the revision at point, or all marked revisions (log-view-revert-or-delete-revisions).

x

Delete revisions newer than the revision at point from the current branch without touching the working tree (log-view-uncommit-revisions-from-end).

X

Delete revisions newer than the revision at point from the current branch (log-view-delete-revisions-from-end).

Because fetching many log entries can be slow, the *vc-change-log* buffer displays no more than 2000 revisions by default. The variable vc-log-show-limit specifies this limit; if you set the value to zero, that removes the limit. You can also increase the number of revisions shown in an existing *vc-change-log* buffer by clicking on the ‘Show 2X entries’ or ‘Show unlimited entries’ buttons at the end of the buffer. However, RCS, SCCS, CVS, and SRC do not support this feature.

A useful variant of examining history of changes is provided by the command vc-region-history (by default bound to C-x v h), which shows a *VC-history* buffer with the history of changes made in the region of the current buffer’s file between point and the mark (see The Mark and the Region). The history of changes includes the commit log messages and also the changes themselves in the Diff format.

Invoke this command after marking in the current buffer the region in whose changes you are interested. In the *VC-history* buffer it pops up, you can use all of the commands available in the *vc-change-log* buffer described above, and also the commands defined by Diff mode (see Diff Mode).

This command is currently available only with Git and Mercurial (hg).

The command vc-log-search allows searching for a pattern in the log of changes. It prompts for a pattern (a regular expression), and displays all entries in the change history whose log messages match the pattern. When invoked with a prefix argument, the command will also prompt for a specific VCS shell command to run for this purpose.