Today I had to google for the 508463460th time how to merge a branch to master, so here we go . . .
The "master" branch is the default that is created when you create your repository. Next to your project name, you'll see the branch you're in. A screenshot of my terminal is below, with the branch in red:
The master branch is (supposed to be) the final, clean, working version. It should always be deployable - if this were a research paper, the master is what you're going to turn in for a grade.
The code that's not production ready goes in another branch. If you are going to be adding a new feature, fixing a bug, generally refactoring: that's what goes in other branches. They should have descriptive names, like
add-login-feature. And then, ideally, what is in that branch is related to what the title is. If you're me, welp:
The point is that you should try and (allegedly) over time it'll get easier.
Yes. No. Sort of? Maybe. Think of the branches more as branches of a metro or subway. If we're using DC's WMATA, the orange line would be the master, and the others are various branches coming and going.
Alright, to create a branch:
git checkout -b new-branch-name git push origin new-branch-name
So you create the branch locally, and then you push it to GitHub. From there you can commit and push as usual.
When you're done and ready to merge to master:
git checkout master git merge new-branch-name
If you want/need more detailed information, you can start here.
One of the most consolidated misconceptions about programming, since the early days, is the idea that such activity is purely technical, completely exact in nature, like Math and Physics. Computation is exact, but programming is not.