5.4.1 Refreshing Diffs
The transient prefix command magit-diff-refresh
, on D
, can be used to change the diff arguments used in the current buffer, without changing which diff is shown. This works in dedicated diff buffers, but also in the status buffer.
D
    (magit-diff-refresh
)​
This transient prefix command binds the following suffix commands along with the appropriate infix arguments and displays them in a temporary buffer until a suffix is invoked.
D g
    (magit-diff-refresh
)​
This suffix command sets the local diff arguments for the current buffer.
D s
    (magit-diff-set-default-arguments
)​
This suffix command sets the default diff arguments for buffers of the same type as that of the current buffer. Other existing buffers of the same type are not affected because their local values have already been initialized.
D w
    (magit-diff-save-default-arguments
)​
This suffix command sets the default diff arguments for buffers of the same type as that of the current buffer, and saves the value for future sessions. Other existing buffers of the same type are not affected because their local values have already been initialized.
D t
    (magit-diff-toggle-refine-hunk
)​
This command toggles hunk refinement on or off.
D r
    (magit-diff-switch-range-type
)​
This command converts the diff range type from "revA..revB" to "revB…revA", or vice versa.
D f
    (magit-diff-flip-revs
)​
This command swaps revisions in the diff range from "revA..revB" to "revB..revA", or vice versa.
D F
    (magit-diff-toggle-file-filter
)​
This command toggles the file restriction of the diffs in the current buffer, allowing you to quickly switch between viewing all the changes in the commit and the restricted subset. As a special case, when this command is called from a log buffer, it toggles the file restriction in the repository’s revision buffer, which is useful when you display a revision from a log buffer that is restricted to a file or files.
In addition to the above transient, which allows changing any of the supported arguments, there also exist some commands that change only a particular argument.
-
    (magit-diff-less-context
)​
This command decreases the context for diff hunks by COUNT lines.
+
    (magit-diff-more-context
)​
This command increases the context for diff hunks by COUNT lines.
0
    (magit-diff-default-context
)​
This command resets the context for diff hunks to the default height.
The following commands quickly change what diff is being displayed without having to using one of the diff transient.
C-c C-d
    (magit-diff-while-committing
)​
While committing, this command shows the changes that are about to be committed. While amending, invoking the command again toggles between showing just the new changes or all the changes that will be committed.
This binding is available in the diff buffer as well as the commit message buffer.
C-c C-b
    (magit-go-backward
)​
This command moves backward in current buffer’s history.
C-c C-f
    (magit-go-forward
)​
This command moves forward in current buffer’s history.