Create a branch: git checkout -b <branch name>
.
Push it upstream to remote: git push -u origin <branch name>
.
If you’re working on multiple branche, keep them up to date with the main branch.
First make sure local is up to date with remote with git update
.
Then on the feature branch, do git merge main
.
When you’re ready to merge the feature into main, first catch it up to main as in the previous paragraph.
Then git checkout main
, and git merge <feature branch>
.
Finally, to detele the feature branch if you are done with it, do git branch -d <feature branch>
and git push origin --delete <feature branch>
.
Last, check the list of branches with git branch -a
.