With the recent change in the default branch naming convention from master
to main
in GitHub, I get an error after every first I push to a new repository (I then create a master
branch, make it default and then delete the main
branch). I do realize that a new branch main
can be created after each git init
, but, I would prefer to not create a branch each time.
Hence, instead of creating a branch each time, is it possible to change the initial default branch to master
across all repositories (globally for a single user)?
Edit:
The commands used are as follows:
git init
git remote add origin <repo-url>
The following doesn't work
git pull
I get:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
However, immediately after a git init
, doing git branch -M main
creates a main
branch and the above problem can be averted. But, I would prefer not to create the same. Instead, can the default branch name be changed globally?