← 返回命令列表

Linux command

tig 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Open the repository browser

tig

Show commit log

tig log

Show status

tig status

Show blame

tig blame [path/to/file]

Show stash

tig stash

Browse commits

tig [path/to/file]

Browse commits

tig [commit1]..[commit2]

Use as pager

git log --pretty=raw | tig --pretty=raw

说明

tig is an ncurses-based text interface for Git. It serves as a repository browser for exploring commit history, viewing diffs, and managing staging. It can also function as a pager for git command output. The main view shows commit history with author, date, and message. Pressing Enter opens the diff view for the selected commit. Use j/k or arrow keys to navigate, / to search, and q to quit or go back. In status view, you can stage changes at the file or chunk level. Press u to stage/unstage files, and navigate into files to stage individual hunks. This provides a visual alternative to git add -p. Configuration is read from ~/.config/tig/config or ~/.tigrc. Colors, keybindings, and views can be customized. Press h in tig to display the help menu with all keybindings.

参数

+_number_
Show first view with the specified line selected.
-C _path_
Run as if tig was started in _path_ instead of the current directory.
--all
Pretend all refs are listed on the command line (shows every branch).
--stdin
Read commit IDs or git output from standard input (pager mode).
--pretty=raw
Process stdin formatted as `git log --pretty=raw` output.
-v, --version
Show version and exit.
-h, --help
Show help message and exit.

FAQ

What is the tig command used for?

tig is an ncurses-based text interface for Git. It serves as a repository browser for exploring commit history, viewing diffs, and managing staging. It can also function as a pager for git command output. The main view shows commit history with author, date, and message. Pressing Enter opens the diff view for the selected commit. Use j/k or arrow keys to navigate, / to search, and q to quit or go back. In status view, you can stage changes at the file or chunk level. Press u to stage/unstage files, and navigate into files to stage individual hunks. This provides a visual alternative to git add -p. Configuration is read from ~/.config/tig/config or ~/.tigrc. Colors, keybindings, and views can be customized. Press h in tig to display the help menu with all keybindings.

How do I run a basic tig example?

Run `tig` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does +_number_ do in tig?

Show first view with the specified line selected.