Default branch names

Hello all!

I had meant to send this out a while back, Github now made it easy to change the default branch name of a repository: GitHub - github/renaming: Guidance for changing the default branch name for GitHub repositories

Across the foreman github organization we have a mix of default branch names of:

  • develop - minority of repos, but high traffic repos (foreman, smart proxy, foreman-installer, etc…)
  • master - the rest (katello, hammer, puppet modules, remote execution, etc…)

Now that there is the easy ability to change these (keep in mind infra updates are required for some repos), I’m curious to gather opinions around this:

  • Gradually move towards using ‘develop’ across most/all repos
  • Gradually move towards unifying on something else (‘main’)
  • Not unify, let individual developers have choice around their repo
  • other (please comment)

0 voters

My preference is that we unify on a single name, likely ‘develop’, but curious what others think.

Justin

I am definitely for unifying the branches, it is quite annoying to remember what branch is the main branch in every repository. I don’t quite care what is that branch as long as we get to one name. develop sounds cool, but it’s extra step when you create new plugin, so it got us to master on most plugins (plugin maintainers just went with git default :man_shrugging: )

While I originally thought develop would be the best, after reading @ezr-ondrej’s comment I voted for main, which is not the git default. That’s quite pragmatic, new plugins will start with whatever the default is for the new repo.

1 Like

I meant which is now the git default :see_no_evil:

The default from git itself is still master:
https://git-scm.com/docs/git-init#Documentation/git-init.txt---initial-branchltbranch-namegt

Git allows you to change the default though.

That means if you run:

git init
git remote add upstream ...
git push --set-upstream upstream HEAD

Then you will end up with a master branch as default, also on Github.

I’m surprised that even after The default branch for newly-created repositories is now main - GitHub Changelog if I create a new repo on github and clone it locally, the branch is master. I don’t think I’d enforce master for my user anywhere.

I think what matters the most is the cloning and forking of the plugin template. Whatever we converge to should be reflected there.

I would counter that since all of the core repos use develop and these also have the biggest amount of automation around them, changing from develop to something else would require a lot of work. On the other hand, most plugin automation uses the same few tasks with just different variables for the specific plugin, so that changing all of them in one go would probably be easier.
If we modify the plugin template default branch to develop I think that people who use it as a template repo will also get the same branch name.
So in short - I’m for switching all to develop.

1 Like

I agree with @tbrisker. Given the whole mess where Github has picked a default of main but git itself hasn’t, it’s still arbitrary. We must document explicit instructions to use something else than master anyway so we may as well standardize on develop to reduce the impact on automation.

Today nightly RPM builds use develop in the release to refer to the branch. Would we change that to main as well? It feels like a step back.

We also have x.y-stable branches. develop and stable are very clear and related. stable and main aren’t. I know at least the discovery plugin also has stable branches.

All in all, I think develop is just the better choice.

I don’t have a preference, in fact I don’t think this is worth the effort. Here is what I have in my .gitconfig:

[alias]
cd = !git checkout rpm/develop || git checkout develop || git checkout master || git checkout main || git checkout gh-pages

I did forget what we actually use for each repository the moment I’ve installed this long time ago.