我想在不克隆它的情况下获得发生在远程仓库中的最后一次提交的散列。有没有办法做到这一点 ?我发现了几种方法,但是为了所有这些方法的工作,我需要首先克隆回购,然后发出命令以获取最后一个提交哈希。
有没有办法我可以在不克隆它的情况下从远程git获得最后一次提交散列吗?
注意:
解决方案 $ git ls-remote github/gturri/dokuJClient.git 2fb540fc8c7e9116791638393370a2fa0f079737 HEAD 2fb540fc8c7e9116791638393370a2fa0f079737 refs / heads / master这个命令可以从任何目录运行。
如果您只想要最后一个sha1,例如在脚本中使用它,您可以这样做:
git ls -remote github/gturri/dokuJClient.git | grep HEAD | awk'{print $ 1}'
I want to get the hash of last commit that has happened in a remote repo without cloning it. Is there a way to do this ? I found several methods but for all of them to work, I need to clone the repo first and then issue the commands to get the last commit hash.
Is there a way I can get the last commit hash from a remote git without cloning it ?
Note:
解决方案 $ git ls-remote github/gturri/dokuJClient.git 2fb540fc8c7e9116791638393370a2fa0f079737 HEAD 2fb540fc8c7e9116791638393370a2fa0f079737 refs/heads/masterThis command can be run from any directory.
If you only want the last sha1, eg to use it in a script, you could then do:
git ls-remote github/gturri/dokuJClient.git | grep HEAD | awk '{ print $1}'
更多推荐
无需克隆即可从远程回购获取最后一次提交散列
发布评论