How To Change Master Branch To Main Branch Before Pushing Remotely To GitHub.
All new source code on GitHub is named "main" not "master" now. I had a local-only project that had a "master" branch on it:
I honestly don't remember how it happened, but irregardless, I wanted to change it to "main" BEFORE I did a remote push to GitHub. This way there are no conflicts/issues.
Here is how you do it:
Go in your terminal window and make sure you are in the right directory. It should say "master". And type "git branch -m master main":
That's it! Honestly!:
Type in "git status" to make sure. Make sure it says "On branch main":
The last step I did to connect my local main branch to a remote repo was to go on GitHub's site and create a repo. After creating the repo I copied the following code and pasted it into my terminal window:
Now the local main branch is connected or synced with the remote main branch. So you are good to go!