Branching

Another major feature of Git is branching. With branches, you can create a copy of your current repository that is isolated from your main branch. So far, we've just committed everything to the default master branch, but you could make a new branch to develop certain features. Think of the many different versions of Linux. They are basically all different branches of the same master branch. Some branches even get their own branch. Ubuntu, for example, is a branch of Debian.

When you first create a Git repository, it will not have any branches by default. You need to add a file and commit it to initialize the master branch. If you have nothing to add to master, because you want to use feature branches, just add a readme, license ...

Get Continuous Integration, Delivery, and Deployment now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.