Sertion / vscode-gitblame

Visual Studio Code Extension - See Git Blame info in status bar.
https://marketplace.visualstudio.com/items/waderyan.gitblame
MIT License
72 stars 31 forks source link
git-blame visual-studio-code vscode-extension

Git Blame

Features:

How to use

Feature Usage

Git blame adds git blame information to your vscode compatible view. See information about what commit last changed a line and how long ago it was. Click the message to see more information about the commit. It is possible to edit all of these information messages in the settings. There are multiple tokens available. These are described below.

Git Blame works very well with WSL but does not work with the web browser based vscode compatible editors.

Configuration

gitblame.commitUrl

Type: string

Default value: "${tool.protocol}://${gitorigin.hostname}${gitorigin.port}${gitorigin.path}${tool.basepath}/${hash}"

Url where you can see the commit by hash

If set to an empty value it will try to guess the URL based on your remote origin. Can only support servers that don't require auth.

Available tokens:

gitblame.pluralWebPathSubstrings

Type: string[]

Default value: ["bitbucket", "atlassian"]

An array of substrings that, when present in the git origin URL, replaces commit with commits in the gitblame.commitUrl token tool.commitpath. Set the value to something that matches anything to recreate the old gitblame.isWebPathPlural-setting.

gitblame.ignoreWhitespace

Type: boolean

Default value: false

Use the git blame -w flag.

gitblame.infoMessageFormat

Type: string

Default value: "${commit.hash} ${commit.summary}"

Message that appears when the gitblame.quickInfo command executes (when you click the status bar message).

gitblame.statusBarMessageFormat

Type: string

Default value: "Blame ${author.name} (${time.ago})"

Message in the status bar about the current line's git blame commit. (Available tokens)[#message-tokens].

gitblame.statusBarMessageNoCommit

Type: string

Default value: "Not Committed Yet"

Message in the status bar about the current line when no commit can be found. No available tokens.

gitblame.statusBarPositionPriority

Type: number

Default value: 500

Priority where the status bar view should be placed. Higher value should be placed further to the left.

gitblame.inlineMessageFormat

Type: string

Default value: "Blame ${author.name} (${time.ago})"

Message on the current line in the editor about the line's git blame commit. (Available tokens)[#message-tokens].

gitblame.inlineMessageNoCommit

Type: string

Default value: "Not Committed Yet"

Message on the current line when no commit can be found. No available tokens.

gitblame.inlineMessageEnabled

Type: boolean

Default value: false

To enable the inline git blame view. Shows blame information at the end of the current line if available.

gitblame.inlineMessageMargin

Type: number

Default value: 2

The amount of margin between line and inline blame view

gitblame.delayBlame

Type: number

Default value: 0

This setting adds a delay (in milliseconds) before the blame is displayed

gitblame.parallelBlames

Type: number

Default value: 2

Limit how many git blame processes the extension can run in parallel. This can help with high CPU usage.

gitblame.revsFile

Type: string[]

Default value: []

List of refs-file names to look for relative to the closest .git-folder. The first file in the list that is accessible will be used with the -S argument in git blame.

Message Tokens

Token Function Parameter Default Value Description
${commit.hash,length} Yes length 64 the first length characters of the 40-bit (or 64-bit) hash unique to the commit
${commit.hash_short,length} Yes length 7 the first length characters of the 40-bit (or 64-bit) hash unique to the commit
${commit.summary} Yes length 65536 the first length characters of the first line of the commit message
${author.name} No - - the commit author's name
${author.mail} No - - the commit author's e-mail
${author.timestamp} No - - timestamp for the commit author's commit
${author.tz} No - - the commit author's time zone
${author.date} No - - the commit author's date (ex: 1990-09-16)
${committer.name} No - - the committer's name
${committer.mail} No - - the committer's e-mail
${committer.timestamp} No - - timestamp for the committer's commit
${committer.tz} No - - the committer's time zone
${committer.date} No - - the committer's date (ex: 1990-09-16)
${time.ago} No - - displays an estimation of how long ago the author committed (e.g. 10 hours ago, 20 days ago, 4 months ago)
${time.c_ago} No - - displays an estimation of how long ago the committer committed (e.g. 10 hours ago, 20 days ago, 4 months ago)

Known issues

The gitblame.gitShow command does not work with my shell

If your default terminal profile is set to cmd.exe gitblame.gitShow will not function correctly. Fix this by using a unix compatible shell.

Acknowledgements