Why I Switched to Lazygit
I once lost important code because of a mistaken force push to the wrong branch — I ran the command too fast, didn’t double-check which branch I was on, and a whole bunch of my teammate’s commits got overwritten. After that incident, I started looking for ways to slow down my Git workflow. Not to type less — but to see more clearly before doing something irreversible. Fortunately, I later learned that Git Reflog can help recover overwritten commits — but it’s not something you want to rely on regularly.
Lazygit came along at exactly the right time. It doesn’t replace Git — it’s an interface layer that sits on top of Git and displays everything right in your terminal. You still have full control over every operation.
What Is Lazygit and How Is It Different from Other GUIs?
Lazygit is a TUI (Terminal User Interface) for Git, written in Go. The binary is only about 7MB and requires no additional dependencies. What sets it apart from desktop GUIs like GitKraken or Sourcetree is that it runs entirely in the terminal — SSH into a VPS, type lazygit, and work as normal.
No mouse required. No leaving the terminal. No memorizing git rebase -i HEAD~5 syntax just to squash a few commits.
Lazygit divides the screen into panels:
- Files — list of changed files (staged/unstaged)
- Branches — list of local and remote branches
- Commits — scrollable, interactive commit history
- Stash — list of stash entries
- Log/Graph — visual commit graph
Installing Lazygit
Ubuntu / Debian
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
macOS (Homebrew)
brew install lazygit
Arch Linux
sudo pacman -S lazygit
After installation, navigate to any Git repository and type:
lazygit
If you see the panel interface appear, you’re all set. Press ? to view all available keyboard shortcuts.
Features I Use the Most
1. Staging Individual Lines Instead of Entire Files
This is my favorite feature. Instead of running git add -p and answering y/n repeatedly, in Lazygit you simply:
- Select a file in the Files panel
- Press Enter to open the diff view
- Use the arrow keys to navigate to the line you want to stage
- Press Space to stage individual lines, or v to select a range then Space
This is incredibly useful when you’ve changed multiple things in the same file but only want to commit part of it — for example, you fixed a bug at the top but aren’t ready to commit the refactor at the bottom.
2. Interactive Rebase Without Memorizing Commands
Before Lazygit, every time I needed to squash commits I had to type git rebase -i HEAD~3, open an editor, change pick to squash, and save — 30 seconds just to squash 2 commits. If you want to understand what’s happening under the hood, this deep-dive on Git interactive rebase covers the full workflow. With Lazygit:
- Switch to the Commits panel (press 4 or click)
- Select the commit you want to work with
- Press s to squash it into the commit above, or r to rename it
Want to reorder commits? Press Ctrl+j / Ctrl+k to drag them up and down directly — far more intuitive than manually editing a text file in vim.
3. Visual Cherry-Pick
Need to grab a commit from another branch? In Lazygit:
- Switch to the source branch in the Branches panel
- Go to the Commits panel and select the commit you want
- Press c to copy (cherry-pick)
- Switch to the target branch and press v to paste
Lazygit highlights the commit being cherry-picked in a different color — you know exactly what you’re doing before confirming. For more advanced cherry-pick scenarios including conflict resolution, mastering Git cherry-pick is worth a read.
4. Easier Stash Management
Ever stashed something and then had no idea what stash@{2} actually contained? The Stash panel lists all entries with their messages and shows a diff preview right there. Press Space to apply, g to pop, d to delete — much cleaner than typing commands blindly. If you’re not already comfortable with Git stash fundamentals, that’s a good place to start before relying on the visual interface.
5. Safer Force Push
After losing code to a mistaken force push, I became very cautious about this step. Lazygit has a force push with lease feature — press shift+P instead of P when pushing. It uses --force-with-lease instead of --force, meaning it will only force push if the remote hasn’t received new commits from someone else. One extra key press, but it prevents exactly the kind of incident I experienced.
Key Shortcuts to Learn When Starting Out
Lazygit has dozens of shortcuts, but you only need these to get started:
Space — Stage/unstage a file or line
Enter — Open a file to stage individual lines / view details
c — Commit (opens a message input form)
P — Push to remote
p — Pull from remote
b — Create a new branch
shift+M — Merge the selected branch into the current branch
R — Rebase the current branch onto the selected branch
q — Quit Lazygit
? — View all shortcuts for the current panel
Integrating Into Your Daily Workflow
I usually alias Lazygit for faster access:
# Add to ~/.bashrc or ~/.zshrc
alias lg='lazygit'
One more tip: Lazygit automatically reloads when you change files from another terminal. Open it in one tmux pane and work in another — the status updates in real time, no manual refresh needed.
If you use Neovim, there’s a lazygit.nvim plugin that lets you open Lazygit in a floating window right inside the editor with a single shortcut.
When You Should Still Use Raw Git Commands
Lazygit doesn’t cover every situation. There are cases where I still type commands directly:
- Git bisect — Lazygit doesn’t have a dedicated UI for this feature yet (see how Git bisect uses binary search to find bug-causing commits)
- Complex submodules — support is basic and not yet comprehensive
- Custom hooks or scripts that need specific output
- Scripting / CI — Lazygit is an interactive tool and isn’t suited for pipelines
Understanding Git fundamentals is still important — Lazygit is just a UI layer that helps you work faster, not a replacement for understanding how Git works under the hood.
Conclusion
After a few months of using Lazygit daily, I’ve noticed that I commit more often, in smaller and more focused chunks — because staging individual lines and writing commit messages has become effortless. And honestly, that’s something I always knew I should be doing — Lazygit just makes it too easy to be lazy about it anymore.
If you’re still copy-pasting Git commands from Stack Overflow every time you need to rebase or cherry-pick, give Lazygit a week — chances are you won’t want to go back to the old way.
