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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.