当前位置:   article > 正文

git 查看提交哈希值_如何在git中获取最新提交的哈希?

gitee查找commithash

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手册

Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/how-to-get-the-latest-commits-hash-in-git/

git 查看提交哈希值

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/598511
推荐阅读
相关标签
  

闽ICP备14008679号