Skip to main content
Magictt integrates Git into your workflow with LazyGit terminal UI and several git-aware plugins for enhanced productivity.

LazyGit Integration

lazygit.nvim embeds the powerful LazyGit terminal UI directly into Neovim, providing a beautiful and efficient way to interact with Git.

What is LazyGit?

LazyGit is a simple terminal UI for git commands. It provides:
  • Visual interface for git operations
  • Keyboard-driven workflow
  • Staging/unstaging changes
  • Interactive commits
  • Branch management
  • Merge conflict resolution
  • Git log visualization
  • Stash management

Features

  • Full LazyGit Access: Complete LazyGit functionality within Neovim
  • Floating Window: Opens in a floating terminal window
  • Multiple Commands: Access different LazyGit modes
  • Seamless Integration: Stays in your editor workflow

Keybindings

KeybindingActionDescription
<leader>llLazyGitOpen LazyGit in floating window

Available Commands

While the primary keybinding is <leader>ll, you can also use these commands:
  • :LazyGit - Open LazyGit (same as <leader>ll)
  • :LazyGitConfig - Open LazyGit configuration
  • :LazyGitCurrentFile - Open LazyGit for current file
  • :LazyGitFilter - Open LazyGit with filter
  • :LazyGitFilterCurrentFile - Filter LazyGit to current file

LazyGit Workflow

Basic Workflow

  1. Open LazyGit
    Press <leader>ll
    LazyGit opens in floating window
    
  2. Navigate Panels
    • Use 1, 2, 3, 4, 5 to switch between panels
    • 1: Status/Files
    • 2: Branches
    • 3: Commits
    • 4: Stash
  3. Stage Changes
    Navigate to file
    Press Space to stage/unstage
    Press a to stage all
    
  4. Commit Changes
    Press c to commit
    Type commit message
    Press Enter to confirm
    
  5. Push Changes
    Press P (capital P)
    Confirm push
    
  6. Close LazyGit
    Press q to quit
    Returns to Neovim
    

Common LazyGit Operations

Staging and Committing

1. Press <leader>ll (open LazyGit)
2. Navigate files panel (panel 1)
3. Use j/k to navigate files
4. Press Space to stage file
5. Press c to commit
6. Type commit message
7. Press Enter
8. Press P to push
9. Press q to close

Branch Management

1. Press <leader>ll
2. Press 2 (switch to branches panel)
3. Press n to create new branch
4. Type branch name
5. Press Enter
6. Press Space to checkout branch

Viewing History

1. Press <leader>ll
2. Press 3 (commits panel)
3. Navigate with j/k
4. Press Enter to see commit details
5. View changed files and diffs

Merge Conflict Resolution

1. Press <leader>ll
2. Navigate to conflicted file
3. Press e to edit file
4. Resolve conflicts in Neovim
5. Save and close
6. Press Space to stage resolved file
7. Continue merge

Stashing Changes

1. Press <leader>ll
2. Press s to stash changes
3. Enter stash message
4. Press 4 to view stash panel
5. Press Space to apply stash
6. Press d to drop stash

LazyGit Keybindings (Inside LazyGit)

KeyAction
1, 2, 3, 4, 5Switch between panels
j / kMove down/up
<C-d> / <C-u>Scroll down/up
[ / ]Previous/next tab

Files Panel

KeyAction
SpaceStage/unstage file
aStage all files
AUnstage all files
dDiscard changes
eEdit file
oOpen file
iIgnore file
rRefresh files
cCommit changes
CCommit with editor

Branches Panel

KeyAction
SpaceCheckout branch
nNew branch
dDelete branch
rRebase branch
MMerge into current
fFast-forward
PPush branch
pPull branch

Commits Panel

KeyAction
EnterView commit details
cCheckout commit
CCopy commit SHA
rRevert commit
RRename commit
dDelete commit
sSquash commit

General

KeyAction
?Open help
qQuit LazyGit
PPush
pPull
RRefresh
+ / -Increase/decrease context

Configuration

Location: lua/magictt/plugins/lazygit.lua
return {
  "kdheepak/lazygit.nvim",
  lazy = true,  -- Lazy load until first use
  cmd = {
    "LazyGit",
    "LazyGitConfig",
    "LazyGitCurrentFile",
    "LazyGitFilter",
    "LazyGitFilterCurrentFile",
  },
  dependencies = {
    "nvim-lua/plenary.nvim",
  },
  keys = {
    { "<leader>ll", "<cmd>LazyGit<cr>", desc = "LazyGit" }
  },
}

Git-Aware Plugins

Several other Magictt plugins integrate with Git:

nvim-tree Git Integration

nvim-tree shows git status for files in the file explorer.

Git Status Icons

In nvim-tree, files are marked with git status:
  • ✓ Staged file
  • ✗ Deleted file
  • ★ Renamed file
  • ✚ Untracked file
  • ● Modified file
  • ◌ Ignored file

Features

  • Visual Indicators: See file status at a glance
  • Not Ignored: Shows .gitignored files (configurable)
  • Folder Status: Folders show aggregated status of contents

Configuration

From lua/magictt/plugins/nvim-tree.lua:
git = {
  ignore = false,  -- Show .gitignored files
}

Telescope Git Integration

Telescope has built-in git pickers (not configured by default, but available). You can add these git-related Telescope commands:
:Telescope git_commits    " View git commits
:Telescope git_bcommits   " View buffer's git commits
:Telescope git_branches   " List git branches
:Telescope git_status     " Git status (like git status)
:Telescope git_stash      " List stash items
To add keybindings, edit lua/magictt/plugins/telescope.lua:
keymap.set("n", "<leader>gc", "<cmd>Telescope git_commits<cr>")
keymap.set("n", "<leader>gb", "<cmd>Telescope git_branches<cr>")
keymap.set("n", "<leader>gs", "<cmd>Telescope git_status<cr>")

Lualine Git Integration

lualine automatically shows git information in the statusline:
  • Current branch name
  • Diff stats (added, modified, removed lines)
This provides constant awareness of:
  • Which branch you’re on
  • How many changes you have

TODO Comments Git Integration

todo-comments.nvim helps track TODO items that often relate to git workflows:
// TODO: Fix before merging PR
// FIXME: Regression from last commit
// HACK: Temporary until feature branch merges
Use <leader>ft to view all TODOs with Telescope. Use <leader>xt to view TODOs in Trouble.

Git Workflow Recommendations

Daily Workflow

Morning: Start Work

1. Pull latest changes
   - Press <leader>ll
   - Press p (pull)
   
2. Create feature branch
   - Press 2 (branches)
   - Press n (new branch)
   - Type "feature/my-feature"
   
3. Start coding
   - Close LazyGit (q)
   - Open files and code

During Development

1. Check file status in nvim-tree
   - Open tree: <leader>ee
   - See modified files with ● icon
   
2. Frequent commits
   - Press <leader>ll
   - Stage files (Space)
   - Commit (c)
   - Add message
   - Commit often!

Before Pushing

1. Review changes
   - Open LazyGit: <leader>ll
   - Check all staged files
   - Review diffs
   
2. Check TODOs
   - Press <leader>ft
   - Ensure no critical TODOs
   
3. Push to remote
   - In LazyGit: Press P
   - Confirm push

Merge Conflict Resolution

1. Identify conflicts
   - Open LazyGit: <leader>ll
   - Conflicted files shown with ✗
   
2. Edit conflict file
   - Navigate to file
   - Press e (edit)
   
3. Resolve in Neovim
   - Use search: /<<<<<<
   - Edit conflict sections
   - Remove conflict markers
   - Save file
   
4. Mark as resolved
   - Back in LazyGit
   - Press Space (stage)
   - Continue merge

Feature Branch Workflow

1. Create branch
   - <leader>ll → 2 → n → type name
   
2. Make changes and commit
   - Code → Stage → Commit (repeat)
   
3. Keep branch updated
   - Switch to main: <leader>ll → 2 → Space on main
   - Pull: p
   - Switch back to feature branch
   - Rebase: r
   
4. Push feature branch
   - <leader>ll → P
   
5. Create PR (outside Neovim)
   - Use GitHub CLI or web interface
   
6. After merge, cleanup
   - Switch to main
   - Pull
   - Delete feature branch: d

Keybindings Summary

Primary Git Keybinding

KeybindingAction
<leader>llOpen LazyGit
KeybindingActionPlugin
<leader>llLazyGitlazygit.nvim
<leader>ftFind TODOstodo-comments (git-related)
<leader>xtTrouble TODOstrouble.nvim
<leader>eeFile tree (git status)nvim-tree

Optional Telescope Git Keybindings

Add these to your config if desired:
KeybindingAction
<leader>gcGit commits
<leader>gbGit branches
<leader>gsGit status

Prerequisites

LazyGit Installation

LazyGit must be installed separately: macOS:
brew install lazygit
Ubuntu/Debian:
sudo add-apt-repository ppa:lazygit-team/release
sudo apt-get update
sudo apt-get install lazygit
Arch Linux:
sudo pacman -S lazygit
Windows:
scoop install lazygit
# or
choco install lazygit
From Source:
go install github.com/jesseduffield/lazygit@latest
Verify installation:
lazygit --version

Git Configuration

Ensure Git is properly configured:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Customization

LazyGit Configuration

LazyGit has its own configuration file at:
  • macOS/Linux: ~/.config/lazygit/config.yml
  • Windows: %APPDATA%\lazygit\config.yml
Customize LazyGit behavior, colors, and keybindings in this file. See LazyGit docs for options.

Change LazyGit Keybinding

Edit lua/magictt/plugins/lazygit.lua:
keys = {
  { "<leader>gg", "<cmd>LazyGit<cr>", desc = "LazyGit" }  -- Use <leader>gg instead
}

Add Telescope Git Pickers

Edit lua/magictt/plugins/telescope.lua to add:
keymap.set("n", "<leader>gc", "<cmd>Telescope git_commits<cr>", 
  { desc = "Git commits" })
keymap.set("n", "<leader>gb", "<cmd>Telescope git_branches<cr>", 
  { desc = "Git branches" })
keymap.set("n", "<leader>gs", "<cmd>Telescope git_status<cr>", 
  { desc = "Git status" })

Configure nvim-tree Git Display

Edit lua/magictt/plugins/nvim-tree.lua:
git = {
  enable = true,       -- Enable git integration
  ignore = true,       -- Hide .gitignored files
  show_on_dirs = true, -- Show status on directories
}

Troubleshooting

LazyGit Not Found

If you see “lazygit not found” error:
  1. Install LazyGit (see Prerequisites)
  2. Ensure it’s in your PATH: which lazygit
  3. Restart Neovim

LazyGit Won’t Open

  1. Check LazyGit works standalone: lazygit in terminal
  2. Check Neovim terminal: :terminal lazygit
  3. Check plugin is loaded: :Lazy

Git Status Not Showing in nvim-tree

  1. Ensure you’re in a git repository: git status
  2. Refresh tree: <leader>er
  3. Check git is enabled in config

Tips and Tricks

LazyGit

  • Use ? inside LazyGit to see all keybindings
  • Press + or - to increase/decrease diff context
  • Use :LazyGitCurrentFile to focus on current file’s history
  • Customize LazyGit colors to match your theme

Git Workflow

  • Commit frequently with descriptive messages
  • Use TODO comments for work in progress
  • Review diffs before committing
  • Keep branches up to date with rebase
  • Use stash for temporary changes

Integration

  • Open LazyGit while file tree is open for full project view
  • Use Telescope to search commits: :Telescope git_commits
  • Check statusline for branch name and changes
  • Use <leader>xt to see all TODOs before committing

Plugin Overview

See all installed plugins

Keybindings

Complete keybinding reference

File Navigation

nvim-tree and other navigation tools

External Resources

Build docs developers (and LLMs) love