Allow the default branch to be main (or whatever your choose) rather than master
The problem I'm trying to solve: I renamed my default branch to main instead of master because I wanted to move away from using the language of oppression in my programming tools: https://tools.ietf.org/id/draft-knodel-terminology-00.html#rfc.section.1.1.1
How I imagine hub could expose this functionality:
hub --set-default main would allow you to change the default branch to main or whatever you chose.
As a starting point, it looks like this may be coded in DefaultBranch which is then called by MasterBranch. Are there other areas where it's hardcoded?
https://github.com/github/hub/blob/93537d457500c1d9f2e5671b9b9b1ebf90a55668/github/localrepo.go#L107-L125
@samjohn Thanks for opening this!
To clarify, is this request that hub adds functionality to rename the default branch in a specific repo?
@archaeocharlie That's a good find, but I think this issue is separate than the functionality proposed in this thread. If some hub doesn't handle well when a default branch is named differently than "master", please open an issue providing more details! 🙇
It appears that hub does not respect the renaming of a default branch. We have changed our default branch on GH to 'main' (without deleting master), but hub opens PRs against 'master' by default.
@DeuceTheCoder This is because git keeps a reference to the old default branch in your local clone. Update it by doing:
git remote set-head origin main