Tig

From G1Joshi/Agent-Skills · View interactive version

Tig is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert Tig assistance covering text-mode interface for Git, interactive staging, commit graph visualization, diff exploration, and blame navigation. Use when navigating Git commit history in the terminal, staging hunks interactively, browsing file changes, or reviewing revisions.

How to use this skill

Skill file

Tig

Tig is an ncurses-based text-mode interface for git. It functions mainly as a Git repository browser.

When to Use

Quick Start

1. Common Invocations

# Open main branch commit graph
tig

# View history of specific file
tig path/to/file.ts

# View diff of uncommitted changes (Status view)
tig status

# Interactive blame view
tig blame path/to/file.ts

2. Essential Navigation Keys

Core Concepts

Production Tig Configuration (`~/.tigrc`)

Customizing colors, keybindings, and view layouts:

# ~/.tigrc
# General settings
set line-graphics = utf-8
set tab-size = 2
set main-view = id date:relative author:email-user commit-title:graph=yes,refs=yes
set diff-view = line-number:yes,interval=5
set status-view = line-number:yes

# Keybindings: Vim navigation
bind generic j move-down
bind generic k move-up
bind generic g move-first-line
bind generic G move-last-line
bind generic <Ctrl-f> page-down
bind generic <Ctrl-b> page-up

# Fast Actions
bind main <Enter> view-diff
bind status u stage-update
bind status s stage-update
bind status c !git commit -v

Interactive Stage View & Hunk Staging

Navigating the Status View to review and stage changes:

# Open Tig directly in status mode
tig status

# Keys in Status View:
# - Press 'u' to stage/unstage a file or hunk
# - Press 'Enter' to open diff view of the selected file
# - Press '1' to stage individual line
# - Press 'c' to open editor and create a commit

Investigating Regressions with `tig blame`

Tracing line modifications through repository history:

# Launch interactive blame viewer for a specific file
tig blame src/auth/jwt_validator.go

# Navigation in Blame View:
# - Press 'Enter' on any line to view the full commit diff that introduced it
# - Press ',' to blame the parent commit before that change
# - Press 'q' to return to previous view

Common Patterns

Custom Tig Keybindings (~/.tigrc)

Problem: Quick terminal staging, rebasing, and branch checkout.

Solution: Define custom hotkeys in ~/.tigrc.

# ~/.tigrc
# Bind 'F' to fetch from origin
bind generic F !git fetch origin

# Bind 'C' in status view to fast-commit
bind status C !git commit -v

# Bind 'P' to push current branch
bind generic P !git push origin HEAD

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| -------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------- |

| Colors hard to read in terminal | Terminal theme contrast clash with default Tig palette | Configure custom colors in ~/.tigrc (e.g. color diff-stat green default). |

| Tig opens in wrong git repository root | Current working directory is inside a submodule or outside repo | Check git rev-parse --show-toplevel before invoking tig. |

| cannot open file: ... on blame view | File was renamed or deleted in working tree | Pass commit ref explicitly: tig blame HEAD~2 -- path/to/file. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.