Terminal GuideTerminal Guide
tig icon

tig

Git Tools
macOSLinux
C

Text-mode interface for Git.

Official Website

Features

Log BrowserBlame ViewDiff ViewTree Browser

Installation

Homebrew
brew install tig
APT (Debian/Ubuntu)
apt install tig
Pacman (Arch)
pacman -S tig

Why use tig?

tig is an ncurses-based text mode Git browser. Written in C, it is extremely lightweight and fast. A tool specialized for viewing Git history, it can be used as an enhanced version of git log.

History Visualization

Clearly visualize commit history with graph display. Intuitively understand branch forks and merges.

Fast Search

Performs quickly even with large repositories. Can search diffs and commit contents rapidly.

Flexible Filtering

Can filter by diverse conditions like author, date, path, and commit message.

Multiple Views

Multiple view modes suited for different purposes like main, log, diff, tree, blob, blame, refs.

Interface

[main view] - commit 1 of 156
──────────────────────────────────────────────────────────────
* abc1234 2 hours ago John Doe
│ feat: add user authentication system
* def5678 1 day ago Jane Smith
│ fix: resolve login redirect issue
* ghi9012 2 days ago John Doe
│\ Merge branch 'feature/dashboard' into main
| * jkl3456 3 days ago Alice
| │ feat: implement dashboard components
* │ mno7890 3 days ago John Doe
│/ docs: update installation guide
* pqr1234 4 days ago Bob
│ refactor: improve code structure
──────────────────────────────────────────────────────────────
[j/k] move [Enter] view diff [q] quit [?] help

tig's main view: Displays commit history in graph format. Branch forks and merges are visually clear.

Installation

Installation
# macOS (Homebrew)
brew install tig

# Ubuntu/Debian
sudo apt install tig

# Fedora
sudo dnf install tig

# Arch Linux
sudo pacman -S tig

# Build from source
git clone https://github.com/jonas/tig.git
cd tig
make prefix=/usr/local
sudo make install prefix=/usr/local

Basic Usage

Startup Commands

Startup Commands
# Show history of current branch
tig

# Show specific branch
tig main
tig feature/new-ui

# Show history of specific file
tig README.md
tig src/main.rs

# Show commits in specific range
tig v1.0..v2.0

# Open in blame view
tig blame README.md

# Open in status view
tig status

# Show stash
tig stash

Key Bindings

KeyActionDescription
j / kMove up/downMove cursor up/down
EnterSelectShow commit details/diff
mMain viewMain commit history display
dDiff viewShow diffs
lLog viewDetailed log display
tTree viewShow file tree
bBlame viewShow per-line change history
rRefs viewBranch and tag list
sStatus viewShow status
/SearchSearch within view
n / NNext/previous resultMove between search results
?HelpShow key binding list
qQuit/backClose view/exit tig

Main View Modes

Main View

Display commit history in graph format. This is the default view.

Main View Operations
# Operations in main view
Enter    # Show diff of selected commit
t        # Show file tree at commit time
C        # Cherry-pick
R        # Revert
G        # Filter with --grep option
F        # Filter by path

Status View

Display information equivalent to git status. Staging and committing is also possible.

Status View Operations
# Operations in status view
u        # Stage/unstage file
!        # Checkout (discard changes)
C        # Commit
M        # Merge
Enter    # Show diff

Blame View

Show when and by whom each line was changed.

Blame View
# Open in blame view
tig blame src/main.rs

# Operations in blame view
Enter    # Show diff of commit that changed this line
,        # Show blame of parent commit (state before change)
<        # Show blame of previous commit

Refs View

Display list of branches and tags. Allows checkout and branch operations.

Refs View Operations
# Operations in refs view
C        # Checkout selected branch
!        # Delete branch
Enter    # Show commit history of branch

Pager Mode

tig can display git command output as a pager.

Pager Mode
# Display git log output with tig
git log --oneline | tig

# Display git show output with tig
git show HEAD | tig

# Display git diff output with tig
git diff | tig

# Set as PAGER environment variable
export GIT_PAGER=tig

Configuration & Customization

Configuration File

Customize in ~/.tigrc.

~/.tigrc
# ~/.tigrc

# Display settings
set main-view = line-number:no,interval=5 id:yes date:relative author:abbreviated commit-title:yes,graph,refs,overflow=no

# UTF-8 support
set line-graphics = utf-8

# Color settings
color cursor white blue bold
color title-focus white blue bold
color title-blur white default

# Number of context lines in diff
set diff-context = 5

# Commit order
set commit-order = default

# Tab width
set tab-size = 4

# Horizontal scroll
set horizontal-scroll = 33%

# Mouse support
set mouse = yes
set mouse-scroll = 5

Customize Key Bindings

Custom Key Bindings
# ~/.tigrc - Custom key bindings

# Cherry-pick commit
bind main P !git cherry-pick %(commit)

# Create branch
bind main B !git checkout -b "%(prompt Enter branch name: )"

# Reset commit
bind main H !git reset --hard %(commit)

# Start rebase
bind main R !git rebase -i %(commit)

# Push
bind status P !git push origin HEAD

# Pull
bind status U !git pull --rebase

Practical Usage Examples

Investigate Change History of Specific File

History Investigation
# Show full history of file
tig -- src/main.rs

# Show changes in specific date range
tig --after="2024-01-01" --before="2024-06-30" -- src/

# Show changes by specific author
tig --author="John" -- src/

Code Review

Code Review
# Check diff between two branches
tig main..feature/new-ui

# Show specific commit range
tig abc1234..def5678

# Check unmerged commits
tig origin/main..HEAD

Tips & Tricks

  • *tig is designed as a read-only tool, but you can add write operations through configuration
  • *Press e to open editor (uses $EDITOR or $TIG_EDITOR)
  • *In blame view, press , to show blame of the line's previous state
  • *Press O to change display options for current view
  • *For large repositories, limit display count like tig -n 100 for faster startup
  • *Press : to open tig prompt, where you can dynamically change options
Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More