Email list hosting service & mailing list manager

main vs master branch Lassi Kortela (06 Nov 2022 22:26 UTC)
Re: main vs master branch Arthur A. Gleckler (06 Nov 2022 22:35 UTC)
Re: main vs master branch Lassi Kortela (06 Nov 2022 22:44 UTC)
Re: main vs master branch siiky (06 Nov 2022 22:51 UTC)
Re: main vs master branch Arthur A. Gleckler (06 Nov 2022 23:41 UTC)
Re: main vs master branch Jeremy Steward (07 Nov 2022 06:31 UTC)
Re: main vs master branch Lassi Kortela (07 Nov 2022 09:00 UTC)
Re: main vs master branch Marc Nieper-Wi├čkirchen (07 Nov 2022 06:47 UTC)
Re: main vs master branch siiky (06 Nov 2022 22:47 UTC)

Re: main vs master branch Jeremy Steward 07 Nov 2022 06:31 UTC

>     I tried to write `srfi clone` so that it works with any default branch
>     name, but I couldn't find any easy way for git to do that.
>
>
> I know it's not pretty, but could you just run the command with one
> name, check the exit value, and try again with the other name if didn't
> work?
>

Just run the following:

     git remote set-head origin -a
     export DEFAULT_BRANCH=$(git rev-parse --abbrev-ref origin/HEAD |
sed 's/origin\///')
     git checkout ${DEFAULT_BRANCH}

Source: this StackOverflow post
<https://stackoverflow.com/questions/62352646/how-do-you-find-the-default-branch-of-a-remote-git-repository>,
adapted by me.

--
Jeremy Steward