Hongmu Notes

git annotate

显示文件中每一行的提交哈希值和最后修改作者。 参见 `git blame`(推荐优先使用该命令)。 提供`git annotate` 主要是为了照顾熟悉其他版本控制系统的用户

100% Browser local processing 0 Data upload

Common examples

打印文件内容,并在每行前附加作者姓名和提交哈希值

git annotate {{路径/到/文件}}

打印文件内容,并在每行前附加作者邮箱和提交哈希值

git annotate {{[-e|--show-email]}} {{路径/到/文件}}

仅打印匹配正则表达式的行

git annotate -L :{{正则表达式}} {{路径/到/文件}}

Tip: curly braces{{…}}It is the parameter that needs to be replaced (path, file name, etc.); the command is only executed in the local terminal, and this site does not save any input.

English original text comparison

Expand English instructions and examples (source tldr-pages)

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

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 :{{regex}} {{path/to/file}}

command information

command namegit annotate
Purpose显示文件中每一行的提交哈希值和最后修改作者。 参见 `git blame`(推荐优先使用该命令)。 提供`git annotate` 主要是为了照顾熟悉其他版本控制系统的用户
Applicable platforms通用
Number of examples3 Article
Official documentationhttps://git-scm.com/docs/git-annotate
Data sourcetldr-pages(CC-BY-4.0)· Community Chinese Translation

FAQ

git annotate What does the command do?

显示文件中每一行的提交哈希值和最后修改作者。 参见 `git blame`(推荐优先使用该命令)。 提供`git annotate` 主要是为了照顾熟悉其他版本控制系统的用户

git annotate How to use it?

Pages listed by scene3Commonly used examples: Each example first explains the purpose, and then gives a complete command that can be directly copied (the parameters that need to be replaced are in the curly brackets).

git annotate What are the most commonly used operations?

打印文件内容,并在每行前附加作者姓名和提交哈希值:git annotate {{路径/到/文件}}

What do the curly braces in the command mean?

curly braces{{…}}Indicates that you need to replace it with your own value, such as path and file name; square brackets for parameters with the same name (such as[-C|--directory]) indicates optional writing.