neogit

A git interface for Neovim, inspired by Magit.

Usage

You can either open Neogit by using the Neogit command:

:Neogit             " Open the status buffer in a new tab
:Neogit cwd=<cwd>   " Use a different repository path
:Neogit cwd=%:p:h   " Uses the repository of the current file
:Neogit kind=<kind> " Open specified popup directly
:Neogit commit      " Open commit popup

Or using the lua api:

local neogit = require('neogit')

-- open using defaults
neogit.open()

-- open a specific popup
neogit.open({ "commit" })

-- open as a split
neogit.open({ kind = "split" })

-- open with different project
neogit.open({ cwd = "~" })

The kind option can be one of the following values:

  • tab (default)
  • replace
  • split
  • split_above
  • vsplit
  • auto (vsplit if window would have 80 cols, otherwise split)

Popups

The following popup menus are available from all buffers:

  • Bisect
  • Branch + Branch Config
  • Cherry Pick
  • Commit
  • Diff
  • Fetch
  • Ignore
  • Log
  • Merge
  • Pull
  • Push
  • Rebase
  • Remote + Remote Config
  • Reset
  • Revert
  • Stash
  • Tag
  • Worktree

Many popups will use whatever is currently under the cursor or selected as input for an action. For example, to cherry-pick a range of commits from the log view, a linewise visual selection can be made, and using either apply or pick from the cherry-pick menu will use the selection.

This works for just about everything that has an object-ID in git, and if you find one that you think should work but doesn’t, open an issue 🙂