Master Lazygit: Quick Install Guide & Essential Commands for Seamless Git Management
This guide introduces Lazygit, an open‑source terminal UI for Git, explains how to install it across macOS, Linux, and Windows using Homebrew, apt, Scoop, and other methods, and walks through its core operations such as staging, committing, pushing, pulling, keybindings, custom commands, and debugging.
Git is a powerful tool, but its many commands can be daunting; Lazygit provides a terminal UI that simplifies Git operations.
Lazygit is an open‑source project maintained by Jesseduffield on GitHub, offering mouse support and other features.
How to Install?
Lazygit provides several installation methods for different platforms.
Homebrew
Tap:
brew install jesseduffield/lazygit/lazygit
Core:
brew install lazygit
Ubuntu (deprecated)
Packages are available via Launchpad PPA.
sudo add-apt-repository ppa:lazygit-team/release sudo apt-get update sudo apt-get install lazygit
Scoop (Windows)
scoop bucket add extras scoop install lazygit
Fedora and CentOS 7
sudo dnf copr enable atim/lazygit -y sudo dnf install lazygit
Go
go install github.com/jesseduffield/lazygit@latest
Basic Lazygit Operations
After installation, run
lazygitinside a local Git repository to open the UI.
You can create an alias, e.g.,
echo "alias lg='lazygit'" >> ~/.zshrc.
Keybindings
Refer to the keybinding list in the documentation.
Common navigation keys include PgUp/PgDn for scrolling, arrow keys for cursor movement,
xto open menus, and mouse support for focusing elements.
Add to Staging
Move focus to the Files pane and click a file to stage it; click again to unstage.
Commit
Stage files, press
xto open the menu, select a commit method, and enter the commit message.
Push
After staging, press
x, choose Push, and provide the necessary information.
Pull
Open the menu and select Pull to fetch from the remote repository.
Change Directory on Exit
Add the following function to
~/.zshrcto change the shell directory after exiting Lazygit.
<code>lg() {
export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir
lazygit "$@"
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null
fi
}
</code>Source the file and use
lgto launch Lazygit; exiting will switch the directory accordingly.
Undo/Redo
See the documentation for details.
Configuration
Refer to the configuration documentation for customization options.
Custom Commands
If Lazygit lacks a feature, you can implement it via custom commands as described in the docs.
Resolving Merge Conflicts
Interactive Rebasing
Local Debugging
Run
lazygit --debugin one terminal and
lazygit --logsin another to view logs side by side.
References
lazygit GitHub repository
Project homepage
Launchpad PPA
Scoop package manager
Copr repository
Keybindings documentation
Undo/Redo documentation
Configuration documentation
Custom commands documentation
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.