LazyGit
Back to Development
LazyGitBeginner8 min

LazyGit Tutorial: Fast Terminal Git UI for Staging, Committing, and Branching

Why LazyGit?

LazyGit is a terminal UI for Git that makes staging, committing, branching, and rebasing visual and fast. If you've ever fumbled with git add -p or struggled with interactive rebase, LazyGit makes those operations point-and-click.

This guide covers the full LazyGit workflow: from installation to custom commands and rebase mastery.

Installation & First Launch

Install LazyGit:

brew install lazygit

Add an alias for convenience:

# ~/.zshrc or ~/.bashrc
alias lg='lazygit'

Staging & Committing Visually

Run lg in any Git repository. The interface has five panels: Status, Files, Branches, Commits, and Stash. Navigate with H/J/K/L (vim-style) or arrow keys.

The bottom bar always shows context-appropriate keybindings. You don't need to memorize everything — just look down.

Branching & Stashing Made Easy

LazyGit's killer feature is line-level staging. In the Files panel, select a file, press Enter to see the diff, then:

Pro tip: Press e on a selected hunk to edit it in your $EDITOR before staging. Perfect for quick fixes mid-staging.

Custom Keybindings & Folders

LazyGit can be extended with custom commands. In ~/.config/lazygit/config.yml:

customCommands:
- key: 'C'
command: "git commit --amend --no-edit"
context: 'files'
description: 'Amend commit without editing message'
- key: 'P'
command: "git push --force-with-lease"
context: 'commits'
description: 'Force push with lease (safe)'
- key: 'f'
command: "git fetch --prune"
context: 'localBranches'
description: 'Fetch and prune remote branches'

Git Operation Recovery

Common issues and fixes:

LazyGit Muscle Memory

You've mastered LazyGit basics. Go deeper:

← PreviousBetterTouchTool Tutorial: Trackpad Gestures, Window Snapping, and Custom ActionsNext →Zellij Terminal Workspace Guide: Layouts, Panes, and the Modern Tmux Alternative