lazygit: The Terminal UI That Makes Git Actually Usable
lazygit: The Terminal UI That Makes Git Actually Usable
Git's command-line interface is powerful and hostile. You can do anything with it, but you need to memorize a dozen flags, understand the difference between reset --soft and reset --mixed, and know that git checkout does four completely different things depending on context. lazygit wraps all of this in a terminal UI where you can see your branches, staged changes, commit history, and stash all at once, and interact with them using single-key shortcuts.
This is not a guide to learning git. This is a guide to using git faster and with fewer mistakes through lazygit.
Installation
# macOS
brew install lazygit
# Fedora
sudo dnf install lazygit
# Ubuntu/Debian (via PPA)
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
# Arch
pacman -S lazygit
# Via go
go install github.com/jesseduffield/lazygit@latest
Then run lazygit (or lg if you set up the alias) in any git repository.
The Interface
lazygit divides the terminal into panels:
- Status (top-left): current branch, upstream tracking info, repo name
- Files (left): unstaged and staged changes, like
git status - Branches (left, tab): local and remote branches
- Commits (left, tab): commit log for the current branch
- Stash (left, tab): stashed changes
- Main view (right): diff output, commit details, or merge conflict resolution
You navigate between panels with Tab/Shift-Tab or number keys (1-5). Within a panel, use j/k or arrow keys to move between items.
Essential Workflows
Staging and Committing
This is where lazygit saves the most time compared to the command line.
In the Files panel:
- Space: toggle stage/unstage a file
- a: stage or unstage all files
- Enter: open a file to stage individual hunks or lines
- c: open the commit message editor
- shift+C: commit with the editor (for multi-line messages)
When you press Enter on a file, lazygit shows the diff. You can then:
- Space: stage/unstage the current hunk
- v: enter line-select mode to stage individual lines
This replaces git add -p, which is one of git's most useful but most painful interactive commands. In lazygit, you see the diff, highlight what you want, press space, and it is staged. No more "Stage this hunk? [y,n,q,a,d,/,s,e,?]" prompts.
Branching
In the Branches panel:
- n: create a new branch
- Space: checkout a branch
- d: delete a branch
- r: rebase current branch onto selected branch
- M: merge selected branch into current branch
- f: fast-forward selected branch if possible
Interactive Rebase
This is where lazygit truly shines. Interactive rebase on the command line means editing a text file with pick, squash, reword, fixup, and hoping you get the order right. In lazygit:
In the Commits panel:
- s: squash the selected commit into the one above it
- f: fixup (squash without keeping the message)
- r: reword a commit message
- d: drop a commit
- e: edit a commit (pause rebase at that point)
- ctrl+j/ctrl+k: move a commit up or down in the history
You see the full commit history, move commits around with keyboard shortcuts, and lazygit executes the rebase. No text file editing, no remembering the syntax.
Resolving Merge Conflicts
When a merge or rebase hits a conflict, lazygit shows the conflicting file with both sides highlighted. You can:
- Space: select which side to keep for the current conflict
- b: keep both sides
- arrow keys: navigate between conflict markers
This is faster than opening a file, searching for <<<<<<<, making a decision, deleting the markers, and repeating. lazygit handles the conflict markers for you.
Stashing
- s (in Files panel): stash all changes
- S: stash with options (staged only, keep index, include untracked)
- Space (in Stash panel): apply a stash
- g: pop a stash (apply and delete)
- d: drop a stash
Cherry-Pick
- shift+C (in Commits panel): copy a commit for cherry-pick
- shift+V: paste (cherry-pick) the copied commit onto the current branch
This works across branches. Navigate to a branch, find the commit you want, copy it, switch branches, and paste.
Configuration
lazygit stores configuration at ~/.config/lazygit/config.yml. Here are the settings worth changing:
gui:
# Show file icons (requires a Nerd Font)
nerdFontsVersion: "3"
# Theme
theme:
activeBorderColor:
- green
- bold
inactiveBorderColor:
- white
# Show bottom line with keybindings
showBottomLine: true
# Mouse support
mouseEvents: true
git:
# Automatically fetch in background
autoFetch: true
autoFetchInterval: 120
# Preferred diff tool
paging:
colorArg: always
pager: delta --dark --paging=never
# Sign commits
commit:
signOff: false
os:
# Editor for commit messages (default uses $EDITOR)
editPreset: "nvim"
# Custom commands accessible via keybindings
customCommands: []
Using Delta as the Pager
If you have delta installed (and you should -- see our modern CLI tools guide), configure lazygit to use it:
git:
paging:
colorArg: always
pager: delta --dark --paging=never
This gives you syntax-highlighted, line-numbered diffs inside lazygit.
Custom Commands
You can bind custom git commands to keys:
customCommands:
- key: "<c-p>"
command: "git push --force-with-lease"
context: "global"
description: "Force push with lease"
- key: "E"
command: "gh pr create --fill"
context: "localBranches"
description: "Create GitHub PR"
- key: "V"
command: "gh pr view --web"
context: "localBranches"
description: "View PR in browser"
Git Alias
Most lazygit users alias it to lg:
# .bashrc or .zshrc
alias lg='lazygit'
Some also configure git itself to launch lazygit:
git config --global alias.ui '!lazygit'
# Now: git ui
When to Use lazygit vs. the Command Line
lazygit excels at:
- Interactive staging: staging individual hunks and lines is dramatically faster
- Interactive rebase: visual commit reordering beats text file editing every time
- Conflict resolution: seeing both sides and picking with a keypress
- Branch management: visual overview of all branches and their status
- Exploration: browsing commit history, diffs, and file changes
The command line is still better for:
- Scripting: automated git operations in CI/CD or shell scripts
- Bulk operations:
git branch -d $(git branch --merged)is faster typed - Specific flags: when you need a particular
git logformat orgit diffoption
The two are complementary, not exclusive. Use lazygit for interactive work and the command line for scripted or one-off precise commands.
lazygit vs. Other Git UIs
lazygit vs. tig: tig is a git viewer -- it is excellent at browsing history and diffs but limited for making changes. lazygit is a full git interface that lets you stage, commit, rebase, and resolve conflicts.
lazygit vs. GitKraken/Fork/Tower: GUI apps with mouse-driven interfaces. They are more discoverable for beginners but slower for keyboard-driven developers. lazygit runs in a terminal, starts instantly, and works over SSH.
lazygit vs. Magit (Emacs): Magit is arguably the gold standard for git interfaces, but it requires Emacs. lazygit gives a similar experience to users of any terminal.
The Bottom Line
lazygit does not teach you new git concepts. It makes the git concepts you already know faster and less error-prone to execute. Interactive rebase goes from "let me look up the syntax" to three keypresses. Staging individual lines goes from a multi-step interactive prompt to a visual selection. If you work with git daily and spend time in a terminal, lazygit is one of those tools that pays for itself in the first hour.