了解何时将一行代码添加到 GitHub 存储库

Know when a line of code was added to a GitHub repository

我想知道如何知道何时将一行代码添加到 GitHub 存储库。

我正在寻找提交哈希,这样我就可以在这行代码上添加评论(而不是打开一个问题)

例如我必须知道这一行什么时候

https://github.com/username/project/blob/master/path/to/file#L6

已添加

所以我可以使用 https://github.com/username/project/commit/COMMIT_HASH

添加关于此行的评论。

直接在 GitHub 上,按钮 "blame" 可以为您提供修改该行的最后一次提交。
但不是 first 提交。

为此,您需要克隆存储库和 use a git log -L:

 git log --pretty=short -u -L 6,6:afile.txt