ls-remote to query remote without fetch
suggest changegit ls-remote queries a remote repository without cloning or fetching it first.
It lists refs/heads and refs/tags on that remote.
An annotated tag can appear twice: refs/tags/v0.1.6 and refs/tags/v0.1.6^{}. The ^{} line is the commit the tag points to.
Since Git 2.8 (March 2016), git ls-remote --refs omits those peeled ^{} lines and pseudorefs such as HEAD, so each tag is listed once:
git ls-remote --refs
It can also help resolve the actual url used by a remote repo when you have "url.<base>.insteadOf" config setting.
If git remote --get-url <aremotename> returns https://server.com/user/repo, and you have set git config url.ssh://git@server.com:.insteadOf https://server.com/:
git ls-remote --get-url <aremotename>
ssh://git@server.com:user/repo
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents