How do I view Git log with graph visualization inside Vim using fugitive?
Answer
:Git log --oneline --graph
Explanation
Tim Pope's vim-fugitive provides a complete Git interface inside Vim. The :Git command runs any Git command with output displayed in a Vim buffer, enabling full Git workflows without leaving the editor. The log view with graph shows branch history visually.
How it works
:Git log --oneline --graph— shows compact commit history with branch graph:Git(no args) — opens interactive status window (stage, unstage, commit):Gdiffsplit— opens a vimdiff of the current file against the index:GBrowse— opens the current file on GitHub in your browser
Example
:Git log --oneline --graph --all
* a1b2c3d (HEAD -> main) feat: add user auth
| * d4e5f6g (feature/api) wip: api routes
|/
* h7i8j9k fix: database connection
* k0l1m2n initial commit
Press <CR> on any commit to view it
Tips
- In the
:Gitstatus window:-to stage/unstage,ccto commit,ddto diff :Git stashand:Git stash popwork inline:Gedit main:file.pyopens a file from another branch0Gclogshows the full history of the current file in quickfix