NeogitOrg /neogit

An interactive and powerful Git interface for Neovim, inspired by Magit

★ 5,677⑂ 368👁 24⑃ 931● 853▤ 3
LuaMITCreated 2020-06-18
Download: v2.0.0v2.0.0 ↓2.0.02024-11-07
+1
Daily
5,677
stars
368
forks
24
watchers
931
prs
853
issues
3
releases

README

Neogit
    
    
        
            
                A git interface for Neovim, inspired by Magit.
            
        
    

  
  
  
  
    
  



!preview


 Installation

Here's an example spec for Lazy, but you're free to use whichever plugin manager suits you.

lua
{
  "NeogitOrg/neogit",
  lazy = true,
  dependencies = {
    -- Only one of these is needed.
    "sindrets/diffview.nvim",        -- optional
    "esmuellert/codediff.nvim",      -- optional

    -- For a custom log pager
    "m00qek/baleia.nvim",            -- optional

    -- Only one of these is needed.
    "nvim-telescope/telescope.nvim", -- optional
    "ibhagwan/fzf-lua",              -- optional
    "nvim-mini/mini.pick",           -- optional
    "folke/snacks.nvim",             -- optional
  },
  cmd = "Neogit",
  keys = {
    { "gg", "Neogit", desc = "Show Neogit UI" }
  }
}


 Usage

You can either open Neogit by using the Neogit command:

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

" Map it to a key
nnoremap gg Neogit


lua
-- Or via lua api
vim.keymap.set("n", "gg", "Neogit", { desc = "Open Neogit UI" })


Or using the lua api:

lua
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 = "~" })

-- You can map this to a key
vim.keymap.set("n", "gg", neogit.open, { desc = "Open Neogit UI" })

-- Wrap in a function to pass additional arguments
vim.keymap.set(
    "n",
    "gg",
    function() neogit.open({ kind = "split" }) end,
    { desc = "Open Neogit UI" }
)


The kind option can be one of the following values:
- tab      (default)
- replace
- split
- split_above
- split_above_all
- split_below
- split_below_all
- vsplit
- floating
- auto (vsplit if window would have 80 cols, otherwise split)

 Configuration

You can configure neogit by running the require('neogit').setup {} function, passing a table as the argument.


Default Config

lua
local neogit = require("neogit")

neogit.setup {
  -- Use Treesitter to apply syntax highlighting to diff hunks
  treesitter_diff_highlight = true,
  -- Apply word-diff highlights to diff hunks
  word_diff_highlight = true,
  -- Hides the hints at the top of the status buffer
  disable_hint = false,
  -- Disables changing the buffer highlights based on where the cursor is.
  disable_context_highlighting = false,
  -- Disables signs for sections/items/hunks
  disable_signs = false,
  -- Path to git executable. Defaults to "git". Can be used to specify a custom git binary or wrapper script.
  git_executable = "git",
  -- Offer to force push when branches diverge
  prompt_force_push = true,
  -- Request confirmation when amending already published c

Top issues

Discussions

Latest release

v2.0.0 v2.0.0 2024-11-07
Removes NeogitCommitMessage and NeogitRebaseTodo filetypes in favor of gitcommit and gitrebase.

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON