git: support arbitrarily named default branch

Attempting to clone a repo where the default/only branch name differs from 'master':

$ git clone https://git.sr.ht/~midipix/mdso

Retrieves the objects, yet fails to check out the branch. The following git clone command, where the branch name is explicitly provided, does however work as expected:

$ git clone -b main https://git.sr.ht/~midipix/mdso

To complete the picture, this works out of the box on opensuse with the following:

$ git --version

git version 2.21.0

Assigned to
1 year, 2 months ago
2 months ago
No labels applied.

~somasis 5 months ago

I'm also experiencing this, unfortunately. GitHub and other similar hosting services appear to support this case fine, though.

~midipix referenced this from #291 4 months ago

~amanjeev 4 months ago

This would be a good thing, because https://leigh.net.au/writing/git-init-main/

~midipix 4 months ago

~amanjeev yes indeed, and that is the main reason for which all of the midipix (and foss21) repositories have had since day one (for more than five years now, earlier development did not use git) a 'main' branch, not a 'master' one. See with your own eyes by visiting dev.midipix.org:-)

~zge 3 months ago

Another use-case is when I'm forking a repository (in my example https://git.sr.ht/~zge/dmenu) and would like the master branch to "mirror" the remote state, while my personal changes are made in a separate branch (in my case local).

~nabijaczleweli 2 months ago

Looks implemented in 0.55.x

~sircmpwn REPORTED IMPLEMENTED 2 months ago

Register here or Log in to comment, or comment via email.