Re: Find main branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller solution is based on the server, which may not be very
easy to do when dealing with Github/Bitbucket/Gitlab and other God
knows which provider.

Konstantin ls-remote solution is the one I'm already using, but if I
have several branches on that commit, I will not be able to decide.

I thought that the 'main' branch information was stored in git, and
possibly with some way to access it with a git command

Thanks,
Pedro Rijo

2016-01-14 18:31 GMT+00:00 Konstantin Khomoutov <kostix+git@xxxxxxxxx>:
> On Thu, 14 Jan 2016 18:17:48 +0000
> pedro rijo <pedrorijo91@xxxxxxxxx> 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.
>
>> 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.



-- 
Obrigado,

Pedro Rijo
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]