Git Hover — Blame, Diff & Issue Links

Rich git blame on hover: commit details, line-level diff and clickable issue links. A lightweight GitLens alternative — zero runtime dependencies, powered only by your local git.
Features
- Per-line blame annotations: shows
author · date · summary as an inline label (font color #527b6f, no background by default; both configurable). When a background is set it wraps the text only and never highlights the code line. By default the annotation is shown only on the line under the cursor; disable "show only active line" in settings to annotate every line.
- Rich hover card: hover over any line to see:
- Commit summary, author, committer, date with timezone, and the full commit hash;
- The author name is a
mailto: link — the email stays hidden and is revealed on hovering the name (click to send an email);
- Issue Linking: issue references in commit messages (e.g.
#123, JIRA-456) are rendered as clickable links that open the issue page; all related issues found in the full commit message are also listed;
- The diff of this exact line in that commit;
- A one-click "View full commit" link and a shortcut to the Issue Linking settings.
- View full commit: opens the full
git show patch of the commit for the current file in a side editor (with diff syntax highlighting).
- Copy commit hash: via the context menu or the command palette.
- Uncommitted line detection: lines not yet committed are labeled as "Uncommitted (working tree changes)".
- Status bar toggle:
$(git-commit) Git Hover: On/Off in the bottom-right corner; click it or press Alt+B.
- Configurable: annotation format, date format, whitespace handling, summary length and more.
Usage
- Open a project inside a Git repository with VS Code.
- Open any tracked file — blame annotations appear at the end of the line.
- Hover over a line to see the commit details and the line-level diff; click "View full commit" in the hover card to open the patch.
- Use the context menu for "View Full Commit / Copy Commit Hash", or search
Git Hover in the command palette for all commands.
Commands
| Command |
Description |
Default keybinding |
Git Hover: Toggle Inline Blame |
Toggle inline annotations |
Alt+B |
Git Hover: Refresh Blame |
Recompute blame for the current file |
— |
Git Hover: View Full Commit |
Open the commit patch in a side editor |
— |
Git Hover: Copy Commit Hash |
Copy the commit hash of the current line |
— |
Git Hover: Open Issue Linking Settings |
Jump to the Issue Linking settings page |
— |
Settings (settings.json)
{
"gitHover.enabled": true, // enable per-line blame
"gitHover.showOnOpen": true, // show automatically when a file is opened
"gitHover.decorationFormat": "${author} · ${date} · ${summary}",
"gitHover.dateFormat": "yyyy-MM-dd", // supports yyyy MM dd HH mm ss
"gitHover.maxSummaryLength": 60,
"gitHover.ignoreWhitespace": true, // git blame -w
"gitHover.prefix": "⎇ ", // distinctive prefix before each annotation (any character, or empty)
"gitHover.accentColor": "#527b6f", // font color; empty = editor default foreground
"gitHover.inlineBackgroundColor": "", // background of the blame text only; empty = no background (default)
"gitHover.inlineGap": "20ch", // left gap between code and blame text (CSS length: 2ch / 1.5em / 16px)
"gitHover.showOnlyActiveLine": true, // only annotate the cursor line; false = annotate every line
// ---- Issue Linking (inspired by Git Graph) ----
"gitHover.issueLinking.enabled": true, // render issue references as clickable links in the hover card
"gitHover.issueLinking.autoDetect": true, // auto-detect rules from the origin remote (GitHub/GitLab/Gitee) when none are configured
"gitHover.issueLinking.rules": [ // custom rules: regex pattern + url template ($1~$9 reference capture groups)
{ "pattern": "#(\\d+)", "url": "https://github.com/owner/repo/issues/$1" },
{ "pattern": "JIRA-(\\d+)", "url": "https://jira.example.com/browse/JIRA-$1" }
]
}
Issue Linking
Inspired by the Issue Linking design of Git Graph:
- Rule =
pattern (regular expression matching an issue reference) + url (issue page template, $1~$9 reference the capture groups).
- Global: configure in your user
settings.json, applied to every project.
- Per project: configure in the project's
.vscode/settings.json (workspace/folder settings) to override the global rules (scope is resource).
- Auto-detect: when no rules are configured anywhere and
issueLinking.autoDetect is true (default), the extension reads the repository's origin remote and generates a default #123 → issue page rule for GitHub / GitLab / Gitee repositories.
- Where it applies: in the hover card — issue references in the commit summary become clickable links, and the full commit message (subject + body) is scanned to list all related issues, opened in your browser on click.
- Rules are matched in order; earlier rules win on overlap; invalid regular expressions are ignored.
Common rule examples:
| Platform |
pattern |
url |
| GitHub |
#(\\d+) |
https://github.com/<owner>/<repo>/issues/$1 |
| GitLab |
#(\\d+) |
https://gitlab.com/<owner>/<repo>/-/issues/$1 |
| Gitee |
#(I[0-9A-Z]+\|\\d+) |
https://gitee.com/<owner>/<repo>/issues/$1 |
| Jira |
([A-Z]+-\\d+) |
https://jira.example.com/browse/$1 |
| TAPD |
--story=(\\d+) |
https://www.tapd.cn/<workspace_id>/prong/stories/view/$1 |
Running multiple git plugins? Every annotation rendered by this extension starts with ⎇ , and the hover card footer says "Provided by Git Hover". For extra visibility, set gitHover.accentColor to a distinctive color.
Development / Debugging
npm install # installs typescript / @types/vscode / @types/node (dev dependencies only)
npm run compile # compiles src/ -> out/extension.js
# or npm run watch for incremental compilation
Press F5 to launch the Extension Development Host, or run Tasks: Run Task → npm: compile from the command palette.
Packaging as .vsix (optional)
npx @vscode/vsce package
Produces git-hover-<version>.vsix (version taken from package.json), installable via "Install from VSIX…" in VS Code.
How it works
- Parses
git blame --line-porcelain to resolve the commit (hash, author, committer, time, summary) of every line.
- Renders inline annotations at the end of the line using the
after attachment of TextEditorDecorationType.
- On hover, runs
git log -L <line>,<line>:<file> -1 -p to extract the exact diff of that line in its commit.
- Refreshes on file switch / save; pure local
git calls, no network services involved.
Notes
- Requires
git installed locally and the file to be inside a Git repository (subdirectories and relative paths are supported).
- Untracked files and non-
file schemes (remote/virtual documents) are not annotated.
License
MIT © Coremory
| |