The main branch of a project is considered the default branch. When anyone visits your repo and forks or clones it, that is the branch that gets checked out and served down locally to their machine.
Most deployments of code come directly from the main branch in git. GitHub, Bitbucket, and GitLab all use “main” as the default branch. Once you have a 1:1 clone of the main branch, you can cut a feature or bug fix branch off of that. Once code is tested and checked, a pull request can be submitted to bring the changes into the main branch.
Branch Naming
If you want to change the name of the main branch, you can. It is advised and best practice to leave the default name to main or change the branch name to main
:
git branch -m master main
Bash