From: Konstantin Khomoutov Date: Thu, 14 Jan 2016 18:53:12 GMT Subject: Re: Find main branch Message-ID: <20160114215312.255f26416bb93beb2e18f1f2@domain007.com> In-Reply-To: On Thu, 14 Jan 2016 18:40:15 +0000 pedro rijo wrote: > 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 It *is* stored in the Git repository -- in the HEAD ref. The question of how to retreive precisely this bit of information -- I don't really know. Basically you want `git show-remote-ref --head` but Git does not have such a command, only `git show-ref` ;-)