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 Lassi Kortela 07 Nov 2022 09:00 UTC

> 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.

Thanks! That did the trick.

`git symbolic-ref --short refs/remotes/origin/HEAD` is a hopefully more
robust equivalent to rev-parse since the former only deals with refs
that are symbolic whereas rev-parse deals with all kinds of refs.

We additionally have to run `git symbolic-ref HEAD refs/heads/<branch>`
to update the local default branch. (`git remote set-head` updates the
local idea of what the remote default branch is...)

I eagerly await the day when they decide to rename the "origin" remote
since it causes an offensive creationism vs atheism debate. And of
course, "git" is offensive to everybody. If only we lived in a more
compassionate world.