/vscode-gitblame

Visual Studio Code Extension - See Git Blame info in status bar.

Primary LanguageTypeScriptMIT LicenseMIT

Git Blame

See Git Blame information in the status bar for the currently selected line.

Quick link to open the latest commit on the current line in the most popular online git tools.

Feature Usage

Install

  1. Open Visual Studio Code
  2. Press Ctrl+Shift+X or ⇧⌘X
  3. Type blame
  4. Click install on Git Blame

Configuration

Setting Type Default Value
Description
gitblame.commitUrl string "guess"
  • Url where you can see the commit by hash
  • "guess" will try to guess the URL based on your remote origin. Can only support servers that don't require auth
  • "no" will not guess and will not show a link
  • Available tokens:
    • ${hash} - the commit hash
    • ${file.path} - the relative file path
    • ${project.name} - your project name (e.g. https://github.com/user/project_name.git)
    • ${project.remote} - the current default remote's URL with the protocol, port-specifiers, and trailing .git stripped. (e.g. https://github.com/user/project_name.git)
    • ${gitorigin.hostname,n} - the nth part of the git origin domain (e.g. if the git origin is https://github.com/ckb-next/ckb-next.git ${gitorigin.hostname,1} will return com)
    • ${gitorigin.path,n} - the nth part of the git origin path (e.g. if the git origin is https://github.com/ckb-next/ckb-next.git ${gitorigin.path,1} will return ckb-next.git)
  • Example: https://github.com/Sertion/vscode-gitblame/commit/${hash}
  • Example: https://${project.remote}/+/${hash}
gitblame.pluralWebPathSubstrings string[] ["bitbucket", "atlassian"]
  • Will automaticly set gitblame.isWebPathPlural to true whenever it detects any of the strings in the array as part of the git origin URL.
  • Ignored when gitblame.isWebPathPlural is set to true.
  • Will only impact gitblame.commitUrl when it is set to "guess".
gitblame.isWebPathPlural boolean false
  • Recommended for BitBucket users.
  • Will only impact gitblame.commitUrl when it is set to "guess".
  • When set to true it will set the url will point to commits instead of commit.
gitblame.ignoreWhitespace boolean false
Use the git blame -w flag
gitblame.infoMessageFormat string "${commit.hash} ${commit.summary}"
Message that appears when the gitblame.quickInfo command executes (when you click the status bar message). Available tokens.
gitblame.statusBarMessageFormat string "Blame ${author.name} ( ${time.ago} )"
Message in the status bar about the current line's git blame commit. Available tokens.
gitblame.statusBarMessageNoCommit string "Not Committed Yet"
Message in the status bar about the current line when no commit can be found. No available tokens.
gitblame.statusBarPositionPriority number undefined
Priority where the status bar view should be placed. Higher value should be placed further to the left.

Message Tokens

Token Function Parameter Default Value Description
${commit.hash} No - - 40-bit hash unique to the commit
${commit.hash_short,length} Yes length 7 the first length characters of the 40-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: Sep 16 1990)
${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)

Acknowledgements