Getting the last commit hash from a remote repo without cloning

前端 未结 2 1436
难免孤独
难免孤独 2020-12-30 05:18

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,

2条回答
  •  难免孤独
    2020-12-30 05:58

    One way would be the following:

    1) Initialize your local repo: git init

    2) Add your the remote to it: git remote add myRemote "https://myremoterepo"

    3) Fetch the repo and check the history for the last commit: git fetch remote

    Alternatively, you could also go to the repo page on github (I assume from your tag) and check the commits tab. It will show you the latest commit and its sha.

提交回复
热议问题