HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

git annotate — Show commit hash and last author on each line of a file. See `git blame`, which is preferred over `g

Submitted by: @import:tldr-pages··
0
Viewed 0 times
hashcommandshowcommitandclilastgit annotate

Problem

How to use the git annotate command: Show commit hash and last author on each line of a file. See git blame, which is preferred over git annotate. git annotate is provided for those familiar with other version control systems. More information: <https://git-scm.com/docs/git-annotate>.

Solution

git annotate — Show commit hash and last author on each line of a file. See git blame, which is preferred over git annotate. git annotate is provided for those familiar with other version control systems. More information: <https://git-scm.com/docs/git-annotate>.

Print a file with the author name and commit hash prepended to each line:
git annotate {{path/to/file}}


Print a file with the author email and commit hash prepended to each line:
git annotate {{[-e|--show-email]}} {{path/to/file}}


Print only rows that match a regex:
git annotate -L :{{regexp}} {{path/to/file}}

Code Snippets

Print a file with the author name and commit hash prepended to each line

git annotate {{path/to/file}}

Print a file with the author email and commit hash prepended to each line

git annotate {{[-e|--show-email]}} {{path/to/file}}

Print only rows that match a `regex`

git annotate -L :{{regexp}} {{path/to/file}}

Context

tldr-pages: common/git annotate

Revisions (0)

No revisions yet.