Re: Find main branch
- From
- Konstantin Khomoutov <kostix+git@007spb.ru>
- Date
- Jan 14, 2016, 18:31 UTC
- Message-ID
- <20160114213113.c700484c7e3acddc467d0e75@domain007.com>
- In-Reply-To
- <CAPMsMoDsay7_n53HY6cxHWEtv5vyugxYUZqwi9tU4dKLv6MGBg@mail.gmail.com>
On Thu, 14 Jan 2016 18:17:48 +0000 pedro rijo <pedrorijo91@gmail.com> wrote:
> If I clone a repo, the repo will be on a specific branch, the 'main' > (typically 'master') branch.
`git clone` checks out the branch which is pointed by by the HEAD ref in the source repository.
Show 5 quoted lines
> Is there any direct command to find that main branch, since that > information is present? > > If so, is there any way to find it without actually cloning the repo > (similar to git ls-remote)?
Run `git ls-remote <url>` and, record the SHA1 name of the HEAD ref, then look that name up in the list of the remaining refs.