Next: , Previous: , Up: Inspecting   [Contents][Index]

5.4 Diffing

The status buffer contains diffs for the staged and unstaged commits, but that obviously isn’t enough. The prefix command magit-diff-popup, on d, features several suffix commands, which show a specific diff in a separate diff buffer.

Like other popups, the diff popup also features several arguments that can be changed before invoking one of the suffix commands. However, in the case of the diff popup, these arguments may be taken from those currently in use in the current repository’s log buffer, depending on the value of magit-use-sticky-arguments (see Popup Buffers and Prefix Commands).

Also see the git-diff(1) manpage.

d     (magit-diff-popup)

This prefix command shows the following suffix commands along with the appropriate infix arguments in a popup buffer.

d d     (magit-diff-dwim)

Show changes for the thing at point.

d r     (magit-diff)

Show differences between two commits.

RANGE should be a range (A..B or A…B) but can also be a single commit. If one side of the range is omitted, then it defaults to HEAD. If just a commit is given, then changes in the working tree relative to that commit are shown.

If the region is active, use the revisions on the first and last line of the region. With a prefix argument, instead of diffing the revisions, choose a revision to view changes along, starting at the common ancestor of both revisions (i.e., use a "…" range).

d w     (magit-diff-working-tree)

Show changes between the current working tree and the HEAD commit. With a prefix argument show changes between the working tree and a commit read from the minibuffer.

d s     (magit-diff-staged)

Show changes between the index and the HEAD commit. With a prefix argument show changes between the index and a commit read from the minibuffer.

d u     (magit-diff-unstaged)

Show changes between the working tree and the index.

d p     (magit-diff-paths)

Show changes between any two files on disk.

All of the above suffix commands update the repository’s diff buffer. The diff popup also features two commands which show differences in another buffer:

d c     (magit-show-commit)

Show the commit at point. If there is no commit at point or with a prefix argument, prompt for a commit.

d t     (magit-stash-show)

Show all diffs of a stash in a buffer.

Two additional commands that show the diff for the file or blob that is being visited in the current buffer exists, see Minor Mode for Buffers Visiting Files.

Next: , Previous: , Up: Inspecting   [Contents][Index]