This is the manual for Tig, the ncurses-based text-mode interface for git. Tig allows you to browse changes in a Git repository and can additionally act as a pager for output of various Git commands. When used as a pager, it will display input from stdin and colorize it.
When browsing repositories, Tig uses the underlying Git commands to present the user with various views, such as summarized commit log and showing the commit with the log message, diffstat, and the diff.
Table of Contents
1. Calling Conventions
1.1. Pager Mode
If stdin is a pipe, any log or diff options will be ignored and the pager view will be opened loading data from stdin. The pager mode can be used for colorizing output from various Git commands.
Example on how to colorize the output of git-show(1):
$ git show | tig
1.2. Git Command Options
All Git command options specified on the command line will be passed to the given command and all will be shell quoted before they are passed to the shell.
|
Note
|
If you specify options for the main view, you should not use the
--pretty option as this option will be set automatically to the format
expected by the main view. |
Example on how to view a commit and show both author and committer information:
$ tig show --pretty=fuller
See the section on specifying revisions for an introduction to revision options supported by the Git commands. For details on specific Git command options, refer to the man page of the command in question.
2. The Viewer
The display consists of a status window on the last line of the screen and one or more views. The default is to only show one view at a time but it is possible to split both the main and log view to also show the commit diff.
If you are in the log view and press Enter when the current line is a commit line, such as:
commit 4d55caff4cc89335192f3e566004b4ceef572521
You will split the view so that the log view is displayed in the top window and the diff view in the bottom window. You can switch between the two views by pressing Tab. To maximize the log view again, simply press l.
2.1. Views
Various views of a repository are presented. Each view is based on output from an external command, most often git log, git diff, or git show.
- The main view
-
Is the default view, and it shows a one line summary of each commit in the chosen list of revisions. The summary includes author date, author, and the first line of the log message. Additionally, any repository references, such as tags, will be shown.
- The log view
-
Presents a more rich view of the revision log showing the whole log message and the diffstat.
- The reflog view
-
Presents a view of the reflog allowing to navigate the repo history.
- The diff view
-
Shows either the diff of the current working tree, that is, what has changed since the last commit, or the commit diff complete with log message, diffstat and diff.
- The tree view
-
Lists directory trees associated with the current revision allowing subdirectories to be descended or ascended and file blobs to be viewed.
- The blob view
-
Displays the file content or "blob" of data associated with a file name.
- The blame view
-
Displays the file content annotated or blamed by commits.
- The refs view
-
Displays the branches, remotes and tags in the repository.
- The status view
-
Displays status of files in the working tree and allows changes to be staged/unstaged as well as adding of untracked files.
- The stage view
-
Displays diff changes for staged or unstaged files being tracked or file content of untracked files.
- The stash view
-
Displays the list of stashes in the repository.
- The grep view
-
Displays a list of files and all the lines that matches a search pattern.
- The pager view
-
Is used for displaying both input from stdin and output from Git commands entered in the internal prompt.
- The help view
-
Displays a quick reference of key bindings.
2.2. Browsing State and User-defined Commands
The viewer keeps track of both what head and commit ID you are currently viewing. The commit ID will follow the cursor line and change every time you highlight a different commit. Whenever you reopen the diff view it will be reloaded, if the commit ID changed. The head ID is used when opening the main and log view to indicate from what revision to show history.
Some of the commands used or provided by Tig can be configured. This goes for some of the environment variables as well as the external commands. These user-defined commands can use arguments that refer to the current browsing state by using one of the following variables.
|
The currently viewed head ID. Defaults to HEAD |
|
The currently selected commit ID. |
|
The currently selected blob ID. |
|
The currently selected branch name. |
|
The currently selected remote name. For remote branches %(branch) will contain the branch name. |
|
The currently selected tag name. |
|
The currently selected stash name. |
|
The current directory path in the tree view or "." if undefined. |
|
The currently selected file. |
|
The currently selected line number. Defaults to 0. |
|
The reference given to blame or HEAD if undefined. |
|
The revision arguments passed on the command line. |
|
The file arguments passed on the command line. |
|
All other options passed on the command line. |