如何在Git中找到分支的哈希? [英] How to find the hash of branch in Git?
本文介绍了如何在Git中找到分支的哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
>命令 git rev-parse
是你的朋友,例如:
$ $ p $ code $ git rev-parse development
17f2303133734f4b9a9aacfe52209e04ec11aff4
code>
...或者用于远程追踪分行:
<$ p $ $ git rev-parse origin / master
da1ec1472c108f52d4256049fe1f674af69e785d
这个命令通常非常有用,因为它可以解析在 git
中指定分支名称的任何方法,例如:
git rev-parse master〜3
git rev-parse HEAD@{2.days.ago}
...等。
Given a local / remote branch name, how could I get the hash of the commit that this branch points to?
解决方案
The command git rev-parse
is your friend, e.g.:
$ git rev-parse development
17f2303133734f4b9a9aacfe52209e04ec11aff4
... or for a remote-tracking branch:
$ git rev-parse origin/master
da1ec1472c108f52d4256049fe1f674af69e785d
This command is generally very useful, since it can parse any of the ways of specifying branch names in git
, such as:
git rev-parse master~3
git rev-parse HEAD@{2.days.ago}
... etc.
这篇关于如何在Git中找到分支的哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文