赞
踩
git 查看提交哈希值
I am looking for a better method for getting the latest commit’s hash in git.
我正在寻找一种更好的方法来获取git中最新commit的哈希值。
I know git log -1
can show the info of the latest commit and from the info of the latest commit I can use grep and other tools to get the hash.
我知道git log -1
可以显示最新提交的信息,根据最新提交的信息,我可以使用grep和其他工具来获取哈希。
Is there better method supported from git?
git支持更好的方法吗?
Note: a better method is introduced in this QA.
注意: 此质量检查中引入了更好的方法。
You can use the --format
option of git log
:
您可以使用git log
的--format
选项:
git log -n1 --format=format:"%H"
Here, “%H” means “commit hash”.
在此,“%H”表示“提交哈希”。
For explanation and other options of the format string, please check git log manual.
有关格式字符串的说明和其他选项,请检查git log手册 。
翻译自: https://www.systutorials.com/how-to-get-the-latest-commits-hash-in-git/
git 查看提交哈希值
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。