23
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

git clone しないでブランチやタグの一覧を表示する

Posted at

今日覚えた Tips のメモ代わりです。

Git のリポジトリのブランチの一覧を git clone しないで表示したい場合は git ls-remote -h コマンドが使えます。

$ git ls-remote -h https://github.com/pypa/pip
68c3cc58a8d1ab8861c34725ce60846be7ccc620	refs/heads/0.5.X
0380b566f6ed67b905c8db003394fca06fdbb574	refs/heads/0.6.X
cf3497005c6fd132caf9ccf2cd3cecbc849ccb16	refs/heads/0.7.X
c6fab6ac5424b18f5cbae9a0ca1aeedfe053a36a	refs/heads/1.3.X
8d8e4e1c09acf95da6b014f44098d4439704b42f	refs/heads/1.4.X
52ffb9f9ea88596e7a7953eaf04eaed681bf19cf	refs/heads/1.5.X
8ba11ed5656f353831fdb36c3ae8b66e6fb3f858	refs/heads/develop
c02811f3d8dfdc4c02835e04ffcc87dc77fd4e84	refs/heads/feature/install-target
...

タグの一覧を表示したい場合は、-h の代わりに -t を指定するだけです。

$ git ls-remote -t https://github.com/pypa/pip
ade11f6eebf16460a7bbe59d7f99b65ce352baf3	refs/tags/0.3
46369de381c86d838367d1030aff681916d8a687	refs/tags/0.4
44625539c248e6b562abb08c75f61082913d693a	refs/tags/0.5
2407b7426e14da75af1b716c8feff8d8fba727dc	refs/tags/0.6
506e575738a301797815c0da929b065fb46726a0	refs/tags/0.6.1
00bcd13bb545379f43ed7beb265961d20044a4be	refs/tags/0.7
edbc041e87a6c6f0d78344299821bba1bc31204b	refs/tags/0.7.1
f54e63e819917de0f0268321178d6be2b7650b49	refs/tags/0.7.2
...

絞り込みも可能です。

$ git ls-remote -t https://www.github.com/pypa/pip 1.4\*
180986fa1b8af83dd321cedba1e01e1eef0393d7	refs/tags/1.4
c6bde0adf737684d69b404c5ce3f92729203c1b7	refs/tags/1.4^{}
158e4eb9892734c5a31d00f659ebf180643b5567	refs/tags/1.4.1
77f959a3ce9cc506efbf3a17290d387d0a6624f5	refs/tags/1.4.1^{}
dcfeb4eb94675c4cf074931b65273104ab29bf2f	refs/tags/1.4rc1
978662b08b118bbeaae5aba57c823090b1c3b3ee	refs/tags/1.4rc2
a1fa1ae8a94182389c9990fe5690269d840bda09	refs/tags/1.4rc3
98ade7af6c4291749de68983b44378cb1ef28161	refs/tags/1.4rc4
70a45c3d074391c0ccd470b2a929ffbd7145782e	refs/tags/1.4rc5

詳細については git-ls-remote のマニュアル をご覧ください。

git ls-remoteGIT v1.5.4 で導入された機能のようですので大抵の環境では使えると思います。

23
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?