如何从短散列获得完整的git提交散列? [英] How to get complete git commit hash from short hash?

查看:137
本文介绍了如何从短散列获得完整的git提交散列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个长度为8个字符的简短git commit散列。我想从远程服务器获得一个完整的散列。我尝试从提交哈希中获取分支名称,然后从分支名称获取完整提交哈希,但它只适用于最新的提交。什么可能是最好的方式来实现我想要的?

I have a short git commit hash of length 8 characters. I want to get a complete hash from remote server. I tried getting the branch name from the commit hash and then getting the full commit hash from branch name but it only works for the latest commit. What could be the best possible way to achieve what I want?

推荐答案

git rev-parse 会给你想要的东西。 / p>

git rev-parse will give you what you want.

$ git rev-parse 3cdd5d
3cdd5d19178a54d2e51b5098d43b57571241d0ab

这篇关于如何从短散列获得完整的git提交散列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆