You quickly get familiar with pushing your local master branch up to your origin remote repository:
git push origin master
You can send up a “side” branch that isn’t the master to your remote repository just as easily:
git push -u origin name-of-side-branch
Note the extra -u
which appears before origin
. It is short for --set-upstream
. Since you’re sending your branch up for the first time, this information tells git to link your local branch to that new one on the remote server for all future updates (fetch/pull/push) between the two. Setting it lets you run other commands without having to retype all the arguments every time (ex: git push
will be enough to update the origin again, instead of git push origin name-of-side-branch
).
In the end, it shows that master or main is just a branch like other branches. It’s just that over the years that people collaborate, it makes sense to use the same name across different projects to refer to “that-branch-which-everyone-pushes-and-pulls-to-and-that-represents-the-official-stable-version”. Hence, main or master.