| 플랫폼 | 명령어 |
|---|
| Ubuntu/Debian | sudo apt update && sudo apt install tig |
| Fedora/RHEL | sudo dnf install tig |
| Arch Linux | sudo pacman -S tig |
| macOS (Homebrew) | brew install tig |
| macOS (MacPorts) | sudo port install tig |
| Windows (Git Bash) | Windows용 Git에 포함됨 |
| Windows (WSL) | sudo apt install tig |
| Windows (Scoop) | scoop install tig |
| From Source | git clone https://github.com/jonas/tig.git && cd tig && make && sudo make install |
tig --version## 설치 | |
| 명령어 | 설명 |
|---|
tig | 현재 저장소의 커밋 기록을 보여주는 메인 뷰 열기 |
tig status | Show working directory status (like git status) |
tig blame <file> | 파일의 줄별 작성자 표시 |
tig <file> | 특정 파일의 커밋 히스토리 표시 |
tig show <commit> | 특정 커밋의 세부 정보 표시 |
tig refs | 모든 브랜치와 태그 표시 |
tig stash | 모든 스태시된 변경 사항 표시 |
tig log | 커밋 로그 보기 |
tig diff | 작업 디렉토리의 스테이징되지 않은 변경 사항 표시 |
tig grep <pattern> | 저장소에서 패턴 검색 |
tig <branch> | 특정 브랜치의 커밋 표시하기 |
tig --all | 모든 브랜치의 커밋 표시 |
tig --help | 도움말 정보 표시 |
tig --version | tig 버전 정보 표시 |
| 키 | 설명 |
|---|
j / ↓ | 한 줄 아래로 이동 |
k / ↑ | 한 줄 위로 이동 |
h / ← | 왼쪽으로 스크롤 |
l / → | 오른쪽으로 스크롤 |
PgUp / b | 페이지 업 |
PgDn / Space | 페이지 다운 |
Home | 첫 번째 줄로 이동 |
End | 마지막 줄로 이동 |
Enter | 항목 열기/선택 (컨텍스트에 따라 다름) |
Tab | 다음 보기로 전환 |
q | 현재 보기 닫기 |
Q | 모든 보기를 닫고 종료 |
R | 현재 보기 다시 로드/새로 고침 |
O | 현재 보기 최대화 |
h | 도움말 및 키 바인딩 표시 |
| 키 | 설명 |
|---|
/ | 앞으로 검색 |
? | 뒤로 검색 |
n | 다음 일치 항목 찾기 |
N | 이전 일치 항목 찾기 |
[ | 이전 차이 청크로 이동 |
] | 다음 차이 청크로 이동 |
{ | diff에서 이전 파일로 이동 |
} | diff에서 다음 파일로 이동 |
| 명령어 | 설명 |
|---|
tig --author="Name" | 특정 작성자의 커밋 필터링하기 |
tig --since="2 weeks ago" | 상대 날짜의 커밋 표시하기 |
tig --after="2024-01-01" --before="2024-12-31" | 날짜 범위 내 커밋 표시 |
tig --grep="pattern" | 메시지에 패턴이 있는 커밋 표시 |
tig --merges | 병합 커밋만 표시 |
tig --no-merges | 병합 커밋 제외 |
tig main..feature | feature에 있는 커밋 중 main에 없는 것 표시하기 |
tig main...feature | 브랜치 간 다른 커밋 표시하기 |
tig --follow -- <file> | 이름 변경을 통해 파일 기록 추적하기 |
tig -S"function_name" | 곡괭이 검색: 변경 발생 커밋 |
tig -G"regex" | 정규식과 일치하는 diff가 있는 커밋 표시 |
tig -n 100 | 최근 100개의 커밋으로 제한 |
tig -- '*.py' | Python 파일에만 영향을 미치는 커밋 표시하기 |
tig reflog | Git reflog 항목 찾아보기 |
tig show <commit>:<path> | 특정 커밋에서 파일 내용 표시 |
tig blame +<line> <file> | 특정 줄 번호에서 blame 보기 열기 |
| 키 | 보기 | 설명 |
|---|
u | 상태 | 파일 또는 청크 스테이징/언스테이징 |
1 | 상태 | 단일 라인 스테이징/언스테이징 |
! | 상태 | 파일 또는 청크 되돌리기 |
C | 상태 | 스테이지된 변경 사항 커밋하기 |
C | 메인/로그 | 체리픽 커밋 |
e | 메인/로그 | 커밋 메시지 편집 (HEAD인 경우) |
! | 메인/로그 | 커밋 되돌리기 |
@ | 메인/로그 | 커밋으로 이동 (체크아웃) |
C | refs | 새 브랜치 생성 |
d | refs | 브랜치 삭제 |
m | refs | 브랜치 병합 |
! | 어떤 | 외부 명령 실행 |
: | 어떤 | Execute git command (e.g., :!git reset) |
$XDG_CONFIG_HOME/tig/config## Tig 내부의 대화형 작업 | | |
~/.config/tig/config## 구성 | | |
Tig는 다음 위치에서 구성을 읽습니다 (우선순위 순):
~/.tigrc``$GIT_DIR/tigrc(일반적으로 /etc/tigrc)```bash
Create user config directory and file
mkdir -p ~/.config/tig
touch ~/.config/tig/config
Or use traditional location
touch ~/.tigrc
# Customize interface colors
color cursor white blue bold
color title-focus white blue bold
color title-blur white black bold
# Diff colors
color diff-header yellow default
color diff-chunk magenta default
color diff-add green default
color diff-del red default
# Status colors
color stat-staged green default
color stat-unstaged red default
color stat-untracked yellow default
``````bash
# Configure main view columns
set main-view = id:yes date:default author:full commit-title:yes,graph:yes,refs:yes
# Set commit ID width
set id-width = 10
# Enable line numbers in blame view
set blame-view = date:default author:full id:yes,color line-number:yes,interval=1 text
# Line number display interval
set line-number-interval = 5
# Horizontal scrolling percentage
set horizontal-scroll = 33%
# Tab size for display
set tab-size = 4
# Truncation indicator
set truncation-delimiter = ~
``````bash
# Number of context lines in diffs
set diff-context = 3
# Ignore whitespace (options: no, all, some, at-eol)
set ignore-space = some
# Use patience diff algorithm
set diff-options = --patience
# Show untracked files in status view
set status-show-untracked-files = yes
```(저장소별)```bash
# Bind 'C' in main view to cherry-pick
bind main C !git cherry-pick %(commit)
# Bind 'P' in status view to push
bind status P !git push
# Bind 'F' to fetch in main view
bind main F !git fetch
# Bind 'S' to create stash
bind status S !git stash save "%(prompt Enter stash message: )"
# Bind 'A' to amend commit
bind status A !git commit --amend
# Open commit in browser (GitHub)
bind main B !@hub browse -- commit/%(commit)
``````bash
# Wrap long lines
set wrap-lines = yes
# Show changes in status view
set status-show-untracked-dirs = yes
# Refresh interval (seconds)
set refresh-mode = auto
set refresh-interval = 1
# Mouse support
set mouse = yes
# Editor for commit messages
set editor-line-number = yes
```(시스템 전체)
### 구성 파일 생성
```bash
# Open repository
tig
# Navigate to commit (use j/k)
# Press Enter to see full diff
# Press Tab to switch between views
# Press q to go back
# Review specific branch
tig feature-branch
# Compare branches
tig main..feature-branch
```### 사용 사례 2: 버그가 도입된 시기 찾기
```bash
# Search for specific code change
tig -S"problematic_function"
# Or search commit messages
tig --grep="bug\|fix" -i
# View blame for specific file
tig blame src/buggy-file.js
# Navigate to suspicious line
# Press Enter to see the commit
# Press Tab to see full commit details
```### 사용 사례 3: 대화형 스테이징 및 커밋
```bash
# Open status view
tig status
# Navigate to files (j/k)
# Press 'u' to stage/unstage files
# Press '1' to stage individual lines
# Press 'C' to commit when ready
# Write commit message and save
```### 사용 사례 4: 프로젝트 히스토리 탐색
```bash
# View all commits with graph
tig --all
# Filter by author and date
tig --author="John Doe" --since="1 month ago"
# View commits affecting specific files
tig -- src/core/*.py
# Follow file through renames
tig --follow -- src/renamed-file.js
```### 사용 사례 5: 브랜치 관리
```bash
# View all branches and tags
tig refs
# Navigate to branch
# Press 'C' to create new branch
# Press 'd' to delete branch
# Press 'm' to merge branch
# Press Enter to view branch commits
```## 모범 사례
- **키보드 단축키 학습**: Tig는 키보드 탐색을 위해 설계되었습니다. 효율적인 탐색을 위해 `j/k`이동, `Enter`드릴다운, 그리고 `q`뒤로 가기를 암기하세요.
- **뷰별 명령어 사용**: 각 뷰마다 다른 작업이 있습니다. 어떤 뷰에서든 `h`를 눌러 해당 컨텍스트의 사용 가능한 키 바인딩을 확인하세요.
- **구성 사용자 정의**: 워크플로우와 선호도에 맞게 색상, 바인딩 및 뷰 설정을 사용자 정의하려면 `~/.config/tig/config`파일을 생성하세요.
- **Git 명령어와 결합**: 시각화에는 tig를, 작업에는 Git 명령어를 사용하세요. Tig는 Git을 대체하는 것이 아니라 보완합니다.
- **대규모 저장소에 필터 사용**: 수천 개의 커밋이 있는 저장소에서는 `--author`, `--since`, `--grep`, 또는 파일 필터를 사용하여 결과를 좁히세요.
- **상태 뷰 활용**: 세분화된 스테이징 제어를 위해 `tig status`를 `git add -p`의 대화형 대안으로 사용하세요.
- **탭으로 탐색**: `Tab`을 사용하여 관련 뷰 간에 순환하고 동일한 데이터의 다른 관점을 확인하세요 (커밋 → 차이 → 트리).
- **저장소별 구성 설정**: 글로벌 구성에 영향을 주지 않고 특별한 설정이 필요한 저장소에 `.git/tigrc`를 생성하세요.
## 문제 해결
| 문제 | 솔루션 |
|-------|----------|
| Tig not found after installation | Ensure tig is in your PATH: `which tig`. Restart terminal or run `source ~/.bashrc` |
| Colors not displaying correctly | Check terminal supports 256 colors. Set `TERM=xterm-256color` or configure colors in `~/.tigrc` |
| Slow performance in large repos | Use filters to limit commits: `tig -n 1000` or `tig --since="1 month ago"`. Consider `set refresh-mode = manual` |
| UTF-8 characters display incorrectly | Set locale: `export LC_ALL=en_US.UTF-8` and `export LANG=en_US.UTF-8` in shell config |
| Mouse not working | Enable in config: `set mouse = yes`. Ensure terminal supports mouse events |
| Can't edit commits or stage files | Ensure you have write permissions and are in a valid Git repository. Check `git status` works |
| Custom key bindings not working | Verify syntax in config file. Check for conflicts with default bindings. Reload with `R` |
| Tig crashes on startup | Check Git repository is valid: `git status`. Update tig to latest version. Remove custom config temporarily |
| Diff view shows binary files | Add to `.gitattributes`: `*.bin -diff`. Or set `set diff-options = --no-binary` |
| Line numbers not showing | Enable in config: `set line-number-interval = 1` and ensure view supports line numbers |
## 빠른 참조 카드```
LAUNCHING TIG NAVIGATION OPERATIONS
tig j/k ↓/↑ Move u Stage/unstage
tig status h/l ←/→ Scroll C Commit/cherry-pick
tig blame <file> PgUp/PgDn Page ! Revert/execute
tig <branch> Enter Select e Edit
tig --all Tab Next view @ Checkout
q/Q Quit R Refresh
SEARCH VIEWS FILTERS
/ Search forward tig Main --author="Name"
? Search backward tig status Status --since="date"
n Next match tig refs Branches --grep="pattern"
N Previous match tig blame Blame --no-merges
[ Prev chunk tig stash Stash -- '*.ext'
] Next chunk tig diff Diff
```