Lazygit — Terminal Git UI Productivity Guide
In this tutorial, you'll learn about Lazygit. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
Lazygit is a terminal-based Git user interface that lets you perform complex Git operations — staging hunks, interactive rebasing, Conflict Resolution, and cherry-picking — through keyboard-driven panels without remembering dozens of Git commands.
What You'll Learn
How to use Lazygit for everyday Git workflows: staging and unstaging files, interactive rebasing, resolving merge conflicts visually, managing branches and stashes, cherry-picking commits, and creating custom commands for repetitive workflows.
Why Lazygit Matters
Git's command-line interface is powerful but verbose. Every git add -p, git rebase -i, or git cherry-pick requires memorizing flags and inspecting diffs manually. Lazygit shows your entire Repository state — unstaged files, staged changes, commit graph, branch tree, and stash list — in one terminal window. You navigate with arrow keys and press single keys to act. Doda Browser's development team uses Lazygit for all code review staging, cutting review time in half.
Learning Path
flowchart LR A[Git Basics] --> B[Git Worktrees] B --> C[Lazygit
You are here] C --> D[Difftastic] C --> E[bat & delta] style C fill:#f90,color:#fff
Installation
# macOS
brew install lazygit
# Ubuntu/Debian
sudo add-apt-repository ppa:lazygit-team/release
sudo apt update && sudo apt install lazygit
# Arch
sudo pacman -S lazygit
# From GitHub releases
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep tag_name | cut -d '"' -f 4 | sed 's/v//')
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/
Basic Navigation
Launch Lazygit from any Git Repository:
cd /path/to/repo
lazygit
| Key | Action |
|---|---|
| Arrow keys / hjkl | Navigate between panels and items |
| Tab / Shift-Tab | Switch between main panels |
| Space | Toggle staging (file or hunk) |
| Enter | Expand diff / enter directory |
| / | Search within current panel |
| q | Quit (or confirm when in prompt) |
| ? | Show keybindings help |
Files Panel — Staging and Committing
Staging Files
Press 1 to focus the Files panel. Use arrow keys to navigate files:
# Create some changes to stage
echo "feature work" >> README.md
echo "new file content" > new-feature.py
In Lazygit:
- Press
Spaceon a file to stage/unstage the entire file - Press
Enterto view the diff, thenSpaceto stage individual hunks - Press
vto toggle staged/staging area view - Press
cto commit with a message prompt
Staging Hunks
For partial staging, navigate to a file, press Enter to see the diff, then:
Spaceto stage the selected hunksto stage hunks line-by-line modeEnteron a hunk to toggle its selection
Commits Panel — History and Management
Press 2 for the Commits panel:
# View commits
# Navigate with arrows
# Press Enter to inspect a commit's changes
# Actions on selected commit
s: squash into below (combine commits)
r: rename commit message
g: reset to this commit (soft/mixed/hard)
c: pick commit (cherry-pick mode)
# Cherry-pick
# Press c to start cherry-pick mode
# Navigate to commits, press c on each to queue
# Press Shift+C to apply cherry-pick
Interactive Rebase
From the Commits panel, press i to start an interactive rebase:
# Select commits to modify
# Actions in rebase menu:
p: pick (keep as is)
r: reword (edit commit message)
e: edit (edit commit content)
s: squash (combine with previous)
f: fixup (squash, discard message)
d: drop (delete commit)
# Press Shift+R to begin the rebase
Branches Panel — Branch Management
Press 3 for the Branches panel:
# Create a new branch
n: new branch (prompts for name)
# Switch branches
Enter: checkout selected branch
Space: checkout with worktree management
# Merge
m: merge selected branch into current
Shift+M: merge with no fast-forward
# Rebase
r: rebase current branch onto selected
Shift+R: rebase onto selected (interactive)
# Delete
d: delete selected branch
Stash Panel
Press 4 for the Stash panel:
# Stash changes (from files panel)
# Press Shift+S to stash staged changes only
# Press S to stash all changes
# From Stash panel:
Space: apply stash
g: pop stash (apply and remove)
d: drop stash
Enter: view stash diff
Merging and Conflict Resolution
When a merge or rebase produces conflicts, Lazygit shows them visually:
# In the Files panel, conflicted files show with both markers
# Press Enter on a conflicted file
# In the diff view:
# 1. Navigate to conflict sections
# 2. Press Space to cycle through resolution options:
# - Take local change
# - Take remote change
# - Keep both
# 3. After resolving all conflicts, stage the file
# Continue the merge/rebase
# Press 'c' to commit merge, or 'g' to continue rebase
Custom Commands
Define custom commands in ~/.config/lazygit/config.yml:
customCommands:
- key: "C"
description: "Conventional commit"
context: "files"
prompts:
- type: "menu"
title: "Commit type"
key: "type"
options:
- name: "feat"
value: "feat"
- name: "fix"
value: "fix"
- name: "chore"
value: "chore"
- name: "refactor"
value: "refactor"
- name: "docs"
value: "docs"
command: git commit -m "{{.Form.type}}: {{index .PromptResponses 0}}"
Diffing Commits
From the Commits panel, select two commits and:
# Select first commit
# Press Shift+Enter to mark as base
# Select second commit
# Press d to show diff between them
# This is equivalent to:
git diff <commit1>..<commit2>
Configuration
# ~/.config/lazygit/config.yml
gui:
theme:
lightTheme: false
activeBorderColor:
- green
- bold
inactiveBorderColor:
- white
optionsTextColor:
- blue
authorColors:
'*': '#b8a0d2'
nerdFontsVersion: "3"
git:
paging:
colorArg: always
pager: delta --dark --paging=never
commit:
autoWrap: false
update:
method: background
Common Errors
1. Lazygit Does Not Show Any Files
You may be in a directory without a .git folder. Run Lazygit from the Repository root. Check with git status.
2. Stash Pop Fails Because Working Directory Is Dirty
Lazygit shows an error. Stage or stash your current changes first, then pop the stash.
3. Interactive Rebase Fails
Merge conflicts during rebase stop the Process. Resolve conflicts in the Files panel, stage resolved files, then press g to continue the rebase.
4. Lazygit Freezes or Lags
Large repositories with thousands of files can slow down Lazygit. Increase git.log.showSignature=false in config or exclude directories in .gitignore.
5. Keybindings Conflict With Terminal
Some terminal emulators override keys like Ctrl+S (flow control). Disable XON/XOFF: stty -ixon in your shell config.
6. Diff Shows No Syntax Highlighting
Install bat or delta and configure the pager in Lazygit config: git.paging.pager: delta --dark.
7. Pushing Fails With Authentication Error
Lazygit uses your configured Git credentials. Set up a credential helper: git config --global credential.helper store or use an SSH key.
Practice Questions
1. What key stages a file or hunk in Lazygit?
Space — toggles staging for the selected file or hunk.
2. How do you start an interactive rebase from Lazygit?
Focus the Commits panel (press 2) and press i to enter interactive rebase mode.
3. How do you view the diff between two arbitrary commits?
Select the first commit, press Shift+Enter to mark it, then select the second commit and press d.
4. How do you cherry-pick multiple commits?
Press c to enter cherry-pick mode, navigate to commits and press c on each to queue them, then press Shift+C to apply.
5. What does pressing 's' on a commit in interactive rebase mode do? It marks the commit to be squashed into the previous commit, combining their changes and messages.
Challenge: Set up a Lazygit workflow for your current project. Create a branch, make three commits, squash the last two, rename the combined commit message, then cherry-pick it to the main branch. Resolve any merge conflicts using Lazygit's visual diff tool. Configure a custom command for conventional commits.
What's Next
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Updated 2026-06-24.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro