How to pull or clone by tag name or commit signature via git

  • We can use git ls-remote to get tag info, I want to know how to checkout the repo with a tag name v2.6.11 or the hash like 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c

  • What the difference between refs/tags/v2.6.11 and refs/tags/v2.6.11^{} ?

    $ git ls-remote git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 14186fea0cb06bc43181ce239efe0df6f1af260a HEAD 14186fea0cb06bc43181ce239efe0df6f1af260a refs/heads/master 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11 c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{} 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11-tree c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11-tree^{} 26791a8bcf0e6d33f43aef7682bdb555236d56de refs/tags/v2.6.12 9ee1c939d1cb936b1f98e8d81aeffab57bae46ab refs/tags/v2.6.12^{} 9e734775f7c22d2f89943ad6c745571f1930105f refs/tags/v2.6.12-rc2 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 refs/tags/v2.6.12-rc2^{} 0397236d43e48e821cce5bbe6a80a1a56bb7cc3a refs/tags/v2.6.12-rc3 a2755a80f40e5794ddc20e00f781af9d6320fafb refs/tags/v2.6.12-rc3^{} ebb5573ea8beaf000d4833735f3e53acb9af844c refs/tags/v2.6.12-rc4 88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 refs/tags/v2.6.12-rc4^{} 06f6d9e2f140466eeb41e494e14167f90210f89d refs/tags/v2. 6.12-rc5 2a24ab628aa7b190be32f63dfb6d96f3fb61580a refs/tags/v2.6.12-rc5^{} 701d7ecec3e0c6b4ab9bb824fd2b34be4da63b7e refs/tags/v2.6.12-rc6 7cef5677ef3a8084f2588ce0a129dc95d65161f6 refs/tags/v2.6.12-rc6^{} 0da688d20078783b23f99b232b272b027d6c3f59 refs/tags/v2.6.13 02b3e4e2d71b6058ec11cc01c72ac651eb3ded2b refs/tags/v2.6.13^{} ...


  • you can simply checkout the SAH-1 or the tag name directly.

    for example:

    git checkout v2.6.12-rc4 
    
    or:
    
    git checkout ebb5573ea8beaf000d4833735f3e53acb9af844c 
    

    are equivalens

    链接地址: http://www.djcxy.com/p/16028.html

    上一篇: git:error:src refspec master不匹配任何

    下一篇: 如何通过标签名称或通过git提交签名来拉取或克隆