我想知道特定提交消息的提交 ID(哈希值)。通常,提交消息是唯一的,因此不应该存在使用同一消息进行多次提交的情况。
以下命令提供了有关提交的完整详细信息,但我只对提交 ID(哈希)感兴趣。我怎么知道呢?
输入:
git log --grep="....commit message that you want to search..."
Run Code Online (Sandbox Code Playgroud)
输出:
commit a5s6d7f8g9cde4100ce92c87c3cff83e8112345de
Author: Authors Name <name@domain.com>
Date: Tue Feb 2 09:22:29 2048 +0000
commit-message: This is the message that i search to get commit hash
Run Code Online (Sandbox Code Playgroud)
预期输出:
a5s6d7f8g9cde4100ce92c87c3cff83e8112345de
Run Code Online (Sandbox Code Playgroud)
添加--format='%H'
git log --grep="....commit message that you want to search..." --format='%H'
更多信息: https: //git-scm.com/docs/pretty-formats
| 归档时间: |
|
| 查看次数: |
2619 次 |
| 最近记录: |