🌳 Easier Git with Lazygit 0/2
See more project context at a glance:
- your changed files and their diffs
- your local and remote branches and how many commits each has to pull/push
- recent commits and their diffs
Execute git commands with single key presses:
- space to stage/unstage a specific file
- a to stage/unstage all changed files
- D to discard all changes
- d to discard changes to the selected file
- enter on a file to move into view that allows you to stage/unstage lines and hunks with space and ?
- enter on a branch to see its commits and their diffs
- enter on a commit to see its changed files and their diffs
- ? to copy a commit from one branch + ? to paste it on another (I.e. Cherry-picking as a familiar copy/paste action)
- f to fetch changes from an upstream branch (e.g. main) + M to merge them into the currently checked out branch (e.g. your-feature-in-progress)
- a to amend a commit by adding the currently staged changes to it
- r to reword a commit message or branch name
- p to pull
- P to push
Want to stage or unstage the changes in the selected file, hunk or line? Press space
. Discard them? Press d
.
Want to stage all your changes? Press a
. Discard them? Press D
.
Complete multistep git workflows visually
- Cherry-pick
- Merge conflicts
Discover what git actions are possible
- While selecting any item (e.g. a file, diff line/hunk, branch, commit), pressing ? will show a searchable menu of relevant commands and what each does
Example workflows
1. Commit changes to a file
space
to stage the filec
to open the commit message inputenter
to commit with the given message
Add screencast?
2.
- GitHub - jesseduffield/lazygit: simple terminal UI for git commands
- git: inline diffs with —word-diff! (intermediate) anthony explains
Why
- Using CLI, hard to remember all commands (no hints available)
- Using VS Code, hard to use keyboard for everything (especially complicated workflows)
- Lazygit is a TUI that makes git workflows easy to complete with quick keypresses
General
- 15 Lazygit Features in Under 15 Minutes • Jesse Duffield 📺
- Make advanced Git tasks simple with Lazygit • Jesse Duffield 📖
Updating feature branch with latest upstream branch
- Move to branches area
- If your feature branch isn’t already checked out, move to it and press
Space
to check it out - Move to the local copy of your upstream branch (e.g.
main
) - Press
f
to fast-forward it to match its upstream (e.g. your localmain
now matches the remotemain
) - Press
M
to merge the local copy of your upstream branch into your checked out branch (orr
to rebase your checked out branch onto it if you prefer)
Splitting an existing commit into multiple commits
- Splitting a commit • Stefan Haller 📖
Inbox
- possible to enforce conventional commits?
- Quick Git Management with Lazygit | Josh Medeski
- Worktree UX · jesseduffield/lazygit · Discussion • worktrees are supported but currently bare repos are not, so watch out for that if your use of worktrees involves cloning a bare repo 💬
- Diff mode by jesseduffield · Pull Request · jesseduffield/lazygit - press c-e on a branch or commit to enter “diff mode”, then select anything else and see the diff of the selected item against that item (e.g. feature branch vs main branch)
- What is the correct way to checkout a tag ? · jesseduffield/lazygit · Discussion • It’s ok to review a PR via checking out the branch as a detached head (rather than creating a local branch); as long as I don’t intend to commit to that branch, a detached head works fine • Stefan Heller 💬
- Functionality similar to VSCodes undo. Revert alternative. · jesseduffield/lazygit · Discussion - To “undo” a commit (instead of reverting it), press
g
on a commit and select “soft reset” - extrawurst/gitui: Blazing 💥 fast terminal-ui for git written in rust 🦀 - lazygit alternative that may perform better (give it a try)
W
to choose any commit/branch as diff target; then, as I select other commits/branches, I’ll see the diff of the selected commit against the one I originally selected; useful for diffing latest local changes vs last pushed changes, current branch vs main branch, etc- NEW Lazygit release! (8 months worth of features) • Walking through what’s new in the April 2024 release • Jesse Duffield 📺