1.2 Git Basics: Branches
In this lesson, I’ll teach you how to use
git branch for fast and efficient management of your source code. Follow along and I’ll show you how to use branches and how to keep them synchronized to a remote server. So that you understand the concept better, I’ll also explain how they are implemented by Git.
Create a new branch and check it out with the following line of code. It’s that easy!
git checkout -b new-feature-branch
If you want to push this branch to a remote Git server, e.g. GitHub, use:
git push origin new-feature-branch
Finally, if you want to merge the branch back into
git checkout master git merge new-feature-branch