diff [-asw] [-C number] [-c commit] [-r repository-path] [object1 object2 | path ...] If invoked within a work tree without any arguments, display all local changes in the work tree. If one or more path arguments are specified, only show changes within the specified paths.
Alternatively, if two object arguments are specified, display the differences between the two objects in the repository. Treat each of the two arguments as a reference, a tag name, an object ID, or a keyword and display differences between the corresponding objects. Both objects must be of the same type (blobs, trees, or commits). An abbreviated hash argument will be expanded to a full commit ID automatically, provided the abbreviation is unique. The keywords ":base" and ":head" resolve to the work tree's base commit and branch head, respectively. The former is only valid if invoked in a work tree, while the latter will resolve to the tip of the work tree's current branch if invoked in a work tree, otherwise it will resolve to the repository's HEAD reference. Keywords and references may be appended with ":+" or ":-" modifiers and an optional integer N to denote the Nth descendant or antecedent by first parent traversal, respectively; for example, :head:-2 denotes the work tree branch head's 2nd generation ancestor, and :base:+4 denotes the 4th generation descendant of the work tree's base commit. Similarly, foobar:+3 will denote the 3rd generation descendant of the commit resolved by the "foobar" reference. A ":+" or ":-" modifier without a trailing integer has an implicit "1" appended (e.g., :base:+ is equivalent to :base:+1).
The key bindings for tog diff are as follows (N denotes optional prefixed count modifier):
a
-
Toggle treatment of file contents as ASCII text even if binary data was detected.
Down-arrow, j, Ctrl-n
-
Scroll down N lines (default: 1).
Up-arrow, k, Ctrl-p
-
Scroll up N lines (default: 1).
Page-down, Space, Ctrl+f, f
-
Scroll down N pages (default: 1).
Page-up, Ctrl+b, b
-
Scroll up N pages (default: 1).
Ctrl+d, d
-
Scroll down N half pages (default: 1).
Ctrl+u, u
-
Scroll up N half pages (default: 1).
Home
-
Scroll to the top of the view.
End
-
Scroll to the bottom of the view.
g
-
Scroll to line N (default: 1).
- G
-
Like g but defaults to the last line in the diff.
- (
-
Navigate to the Nth previous file in the diff (default: 1).
- )
-
Navigate to the Nth next file in the diff (default: 1).
- {
-
Navigate to the Nth previous hunk in the diff (default: 1).
- }
-
Navigate to the Nth next hunk in the diff (default: 1).
- [
-
Reduce diff context by N lines (default: 1).
- ]
-
Increase diff context by N lines (default: 1).
- <,
Comma, K
-
If the diff view was opened via the log view, move to the Nth previous (younger) commit. If the diff was opened via the blame view, move to the Nth previous line and load the corresponding commit (default: 1).
- >,
Full stop, J
-
If the diff view was opened via the log view, move to the Nth next (older) commit. If the diff was opened via the blame view, move to the Nth next line and load the corresponding commit (default: 1).
p
-
Write the currently viewed diff to a patch file in /tmp. The patch pathname is drawn to the status line.
/
-
Prompt for a search pattern and start searching for matching lines. The search pattern is an extended regular expression. Regular expression syntax is documented in re_format(7).
n
-
Find the Nth next line which matches the current search pattern (default: 1).
- N
-
Find the Nth previous line which matches the current search pattern (default: 1).
w
-
Toggle display of whitespace-only changes.
- A
-
Change the diff algorithm. Supported diff algorithms are Myers (quick and dirty) and Patience (slow and tidy). This is a global setting which also affects the blame view.
The options for tog diff are as follows:
-
-a
-
Treat file contents as ASCII text even if binary data is detected.
-
-C number
-
Set the number of context lines shown in the diff. By default, 3 lines of context are shown.
-
-c commit
-
Show differences between commits in the repository. This option may be used up to two times. When used only once, show differences between the specified commit and its first parent commit. When used twice, show differences between the two specified commits.
The expected argument is a commit ID hash, or an existing reference, tag name, or keyword, which is resolved to a commit ID. Unique abbreviated hash arguments are automatically expanded to a full hash. Both objects must be of the same type (i.e., blobs, trees, or commits).
If the -c option is used, all non-option arguments are interpreted as paths. If one or more such path arguments are provided, only show differences for the specified paths.
-
-r repository-path
-
Use the repository at the specified path. If not specified, assume the repository is located at or above the current working directory. If this directory is a got(1) work tree, use the repository path associated with this work tree.
-
-s
-
Show changes staged with got stage instead of showing local changes in the work tree. This option is only valid when tog diff is invoked in a work tree with no -c options.
-
-w
-
Ignore whitespace-only changes.