mk12 / vscode-better-git-line-blame

VS Code extension that decorates lines with git blame information.
https://marketplace.visualstudio.com/items?itemName=mk12.better-git-line-blame
MIT License
39 stars 3 forks source link

VS Code: Better Git Line Blame

A simple VS Code extension that annotates the current line with git blame information.

It's like the GitLens line annotation feature, but faster.

Install

Get Better Git Line Blame on the Visual Studio Marketplace.

Features

Commands

Configuration

FAQ

Do I need to reblame?

Only if you're seeing "Uncommited changes" on lines with no diff.

The extension keeps track of local edits, and reblames on git HEAD changes, so you don't normally need to run the "Reblame File" command or use the betterGitLineBlame.reblameOnSave configuration. However, if you change a line and then later undo it, the annotation will still be "Uncomitted changes". If you want to see the original commit, you need to reblame.

Why do annotations flicker when I delete or join lines?

By default, the extension attaches annotations to the end of the line. When you use VS Code's "Delete Line" or "Join Lines" commands, the annotation might briefly appear in the middle of a line, shifting the rest of the line to the right, before correcting itself. This is usually more noticeable when using Remote Development.

If this bothers you, you can enable the betterGitLineBlame.annotateWholeLine configuration property. This makes the annotations use isWholeLine: true, ensuring they never appear in the middle of a line. The downside is that commit information will show when you hover anywhere on the line, not just when you hover on the blame annotation. In particular, it will get combined with hover messages provided by other extensions, such as type information and documentation.

Alternatives

The alternative I'm competing with is GitLens. I find it too bloated, and dislike how it pushes paid features.

Someone else had the exact same idea with carlthome/vscode-git-line-blame. However, as of March 2024, that extension is much simpler: it spawns a git process every time the text cursor moves.

License

© 2024 Mitchell Kember

VS Code Git Line Blame is available under the MIT License; see LICENSE for details.