lazygit
A terminal interface for staging, committing, rebasing, cherry-picking, browsing, and managing Git repositories.
Why consider lazygit?
lazygit is an open-source terminal user interface for Git commands built in Go. It allows developers to stage files, manage branches, resolve conflicts, and run interactive rebases with keyboard shortcuts.
Learn lazygit by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide2 sections
Terminal Git Management with lazygit
Navigating Git branches, diffs, and staging areas through standard command-line flags can become tedious in large codebases. According to the project documentation, Default path for the global config file: - Linux: ~/.config/lazygit/config.yml - MacOS: ~/Library/Application\ Support/lazygit/config.yml. This setup allows terminal users to quickly customize layout styles, color schemes, and keybindings across their preferred workstation environment without depending on heavy graphical user interfaces.
For team repositories that require shared conventions, lazygit also supports localized repository configurations. As noted in the documentation, In addition to the global config file you can create repo-specific config files in <repo>/.git/lazygit.yml. This feature guarantees that team-specific commands or custom diff viewers can be committed or shared locally across development environments without interfering with global personal defaults.
Interactive Commit Workflows and Fixup Commits
When collaborating on pull requests, managing a clean commit history often requires creating fixups rather than squashing prematurely. In lazygit, in the Commits view, select the commit that you want to create a fixup for, and press shift-F. This generates a designated fixup commit with the appropriate subject line prefix, keeping reviewer feedback transparent until the final rebase before merge.
Undoing mistakes during branch manipulation is another critical capability handled natively. As explained in the documentation, You can undo the last action by pressing 'z' and redo with 'Z' (shift+z). This single-key convenience allows developers to walk back mistaken branch checkouts or commits effortlessly.
It is essential to understand the architectural scope and limitations of the built-in undo system. Specifically, Undo uses the reflog which is specific to commits and branches so we can't undo changes to the working tree or stash. By leveraging Git's underlying reflog, the interface reconstructs previous repository states safely without risking unexpected modifications to untracked working directory files.
Custom Command Keybindings Configuration
Developers with specific tooling requirements can extend the interface with tailored shortcuts and menus. As described in the documentation, Custom command keybindings will appear alongside inbuilt keybindings when you view the keybindings menu by pressing '?'. These additions integrate directly into the interactive help interface, making external scripts and tools immediately discoverable.
According to the documentation, You can add custom command keybindings in your config.yml (accessible by pressing 'e' on the status panel from within lazygit) to streamline repetitive operations. Below is the official example demonstrating this configuration structure:
customCommands: - key: '<c-r>' context: 'commits' command: 'hub browse -- "commit/{{.SelectedLocalCommit.Hash}}"' - key: 'a' context: 'files' command: "git {{if .SelectedFile.HasUnstagedChanges}} add {{else}} reset {{end}} {{.SelectedFile.Name | quote}}" description: 'Toggle file staged' - key: 'C' context: 'global' command: "git commit" output: terminal - key: 'n' context: 'localBranches' prompts: - type: 'menu' title: 'What kind of branch is it?' key: 'BranchType' options: - name: 'feature' description: 'a feature branch' value: 'feature' - name: 'hotfix' description: 'a hotfix branch' value: 'hotfix' - name: 'release' description: 'a release branch' value: 'release' - type: 'input' title: 'What is the new branch name?' key: 'BranchName' initialValue: '' command: "git flow {{.Form.BranchType}} start {{.Form.BranchName}}" loadingText: 'Creating branch'Official release distributions and pre-built binaries across operating systems are tracked at the v0.64.1 release page, while community discussions and issue tracking take place at the main lazygit repository where Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files under standard open-source distribution terms.
Related tools
More options with a similar category or technology profile.
diskus
Minimal, fast alternative to du -sh written in Rust using multi-threaded directory traversal.
peco
Simplistic interactive filtering tool for Unix pipelines, process lists, and file trees.
Dapr CLI
Command-line tool for managing Dapr distributed application runtime environments and sidecars.
Freeze
Generate beautiful image screenshots and SVGs of code snippets and terminal outputs.