How to Install and Use Tig in Linux for an Interactive Text-Mode Git Interface

Tracking version control history, reviewing commit diffs, and staging selective code hunks inside the Linux terminal often leads developers to juggle multiple separate Git commands such as git log --graph, git diff, git status, and git blame. While modern terminal GUIs have gained popularity, experienced Unix developers and DevOps engineers frequently prefer a lightning-fast, zero-dependency ncurses client that works seamlessly over low-bandwidth SSH sessions. Tig is a classic, battle-tested text-mode interface for Git that acts primarily as a Git repository browser and interactive staging environment directly within your terminal console.

Key Advantages of Using Tig

Tig bridges the gap between raw Git CLI flags and full-blown graphical Git clients:

  • Instant Repository Graphs: Renders visual branch topologies, merge nodes, author timestamps, and commit titles with zero rendering delay even on repositories containing tens of thousands of commits.
  • Interactive Hunk Staging: Inspect unstaged modifications and stage or unstage individual diff hunks or discrete lines with a single keystroke.
  • Interactive Blame Explorer: Navigate line-by-line file blame histories; pressing Enter on any blamed line instantly jumps to the exact commit that introduced the change.
  • Lightweight ncurses Architecture: Requires no web rendering engines, Electron frameworks, or heavy runtime dependencies—making it ideal for minimal cloud servers and headless containers.
  • Custom Views and Pagers: Operates both as an interactive full-screen browser and as an enhanced terminal pager for standard Git commands.

Prerequisites and System Compatibility

Tig is packaged across all standard Linux distribution repositories:

  • Ubuntu / Debian / Linux Mint:
    sudo apt update && sudo apt install tig
  • Fedora / RHEL / CentOS Stream:
    sudo dnf install tig
  • Arch Linux / Manjaro:
    sudo pacman -S tig
  • Alpine Linux:
    sudo apk add tig

Step-by-Step: Navigating the Tig Interface

To launch Tig inside any existing Git repository, navigate to the project directory and run:

cd ~/Development/my-project
tig

By default, Tig opens the Main View, displaying an interactive commit log graph.

Primary Views in Tig

Tig uses single-key shortcuts to transition between dedicated operational views:

  • m (Main View): Displays the branch commit graph, commit hashes, dates, and author names.
  • d (Diff View): Inspects the full unified diff of the currently highlighted commit.
  • s (Status View): Shows tracked, untracked, staged, and modified files in your working tree.
  • b (Blame View): Displays author blame information for the selected file. Run directly via: tig blame path/to/file.py.
  • r (Refs View): Lists all local branches, remote-tracking branches, and tags.
  • t (Tree View): Browse the repository directory structure at any historical commit.
  • q: Close the current view or exit Tig.

Interactive Staging and Commit Creation

Tig provides one of the fastest workflows for staging partial changes before committing:

  1. Press s to switch to the Status View.
  2. Use j and k to move your cursor through modified files.
  3. Press u on any file to toggle its staging status (equivalent to git add or git reset).
  4. To stage specific hunks rather than the entire file, highlight the modified file and press Enter to view its diff.
  5. Navigate to the specific diff hunk you want to include, and press u to stage only that hunk.
  6. To record your commit: While in Status View, press C (capital C). Tig opens your configured default text editor (e.g., Nano, Vim, or Neovim) to draft and save your commit message.

Searching and Inspecting Commit Logs

Tig supports rapid Vim-style text searching:

  • Press / followed by a search query (such as a commit message keyword or author name) and press Enter.
  • Press n to cycle forward through matches, or N to cycle backwards.
  • Press h at any time to open the built-in Help view detailing all available view-specific shortcuts.

Customising Tig with ~/.tigrc

You can fine-tune Tig’s colour schemes, tab sizes, and keybindings by editing your personal configuration file at ~/.tigrc:

# Enable line numbers in diff and blame views
set line-number-interval = 1

# Configure tab width
set tab-size = 4

# Show commit dates in relative format (e.g., "2 days ago")
set main-view-date = relative

# Custom shortcut to push to origin
bind status P !git push origin HEAD

Save the file; Tig automatically loads these custom preferences upon its next invocation.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.