How to Install and Use Lazygit – A Terminal UI for Git
This guide introduces Lazygit, an open‑source terminal UI for Git, explains its key features such as mouse support, and provides step‑by‑step installation commands for Homebrew, Ubuntu, Windows Scoop, Fedora/CentOS, and Go, followed by essential usage tips, key bindings, custom commands, and debugging options.
Git’s power is well known, but its many commands can be cumbersome; Lazygit is an open‑source terminal UI that simplifies Git operations and even supports basic mouse control.
Lazygit is maintained by Jesseduffield on GitHub. For a quick feature overview, watch the video at https://youtu.be/CPLdltN7wgE.
Installation methods :
Homebrew (macOS/Linux)
brew install jesseduffield/lazygit/lazygit brew install lazygitUbuntu (PPA – deprecated for updates)
sudo add-apt-repository ppa:lazygit-team/release
sudo apt-get update
sudo apt-get install lazygitScoop (Windows)
scoop bucket add extras
scoop install lazygitFedora and CentOS 7 (Copr)
sudo dnf copr enable atim/lazygit -y
sudo dnf install lazygitGo install
go install github.com/jesseduffield/lazygit@latestBasic operations : after installation run lazygit inside any local repository. You can create an alias, e.g., echo "alias lg='lazygit'" >> ~/.zshrc . Use the displayed help at the bottom of the UI for navigation: PgUp/PgDn to scroll, arrow keys to move the cursor, x to open menus, and mouse clicks to focus elements.
To stage files, move to the Files pane and click the desired file; clicking again unstages it. Commit by selecting staged files, pressing x , choosing a commit method, and entering a message. Push and Pull are also accessed via the x menu.
To change the shell’s directory after exiting Lazygit, add the following function to your rc file:
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
}Undo/redo, configuration, and custom commands are documented in Lazygit’s official docs (see references). Use lazygit --debug and lazygit --logs in separate terminals for local debugging.
References
GitHub repository: https://github.com/jesseduffield/lazygit
Video demo: https://youtu.be/CPLdltN7wgE
Launchpad PPA: https://launchpad.net/~lazygit-team
Scoop: https://scoop.sh/
Copr: https://copr.fedorainfracloud.org/coprs/atim/lazygit/
Key bindings: https://github.com/jesseduffield/lazygit/tree/master/docs/keybindings
Undo documentation: https://github.com/jesseduffield/lazygit/blob/master/docs/Undoing.md
Custom pager docs: https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md
Custom command keybindings: https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Command_Keybindings.md
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
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.