LazyGit
Back to Development
LazyGitIntermediate10 min

LazyGit Custom Commands and Keybindings: Extend Your Git TUI

Extending LazyGit with Commands

Go beyond the default LazyGit experience. Create custom commands, define your own keybindings, and build a git workflow tailored to your team's conventions.

LazyGit gives Git a visual interface in the terminal. Stage individual lines, resolve rebase conflicts visually, and never type git add -p again.

By the end of this 10 min guide, you'll have a working Lazygit setup and practical LazyGit workflows you can use immediately.

Config File & Custom Command Syntax

Install Lazygit:

brew install lazygit
Tip: Verify the installation with lazygit --version or lazygit -V after installing.

Writing Useful Custom Commands

Run lg in any repo. Five panels — Status, Files, Branches, Commits, Stash — with vim-style navigation. The bottom bar shows context-aware keys.

Here's a foundational configuration to start with:

# config.yml
gui:
mouseEvents: true
showIcons: true
customCommands:
- key: "C"
command: "git commit --amend --no-edit"
context: "files"

Keybinding Customization

With Lazygit configured, these LazyGit-specific workflows will save you time every day:

Pro tip: Don't try to adopt everything at once. Start with Space stage/unstage files or hunks and add more as it becomes habit.

Integration with Shell Scripts

Once you're comfortable with Lazygit basics, these advanced techniques will transform your LazyGit workflow:

Command Errors & Recovery

Here are the most common Lazygit issues and how to fix them:

Your Custom Git Stack

Congratulations — you now have a solid Lazygit foundation. Here's where to go next:

← PreviousBetterTouchTool Remote and Custom Widgets: Control Your Mac from iPhone and iPadNext →LazyGit Rebase and Conflict Resolution: A Visual Guide to Interactive Rebasing