Working with branches

One of the great powers of Git is the cheapness of creating branches. Branches are a way to create new code away from the central code path. You can see a branch as a tree, and you have a tree branch that sticks out of the tree.

So, when you want to test a new feature, just create a new branch. If you like the feature, you can merge it back. If you don't like the feature, you can remove the branch and no harm is done to the main branch.

In this recipe, we will take a look at how to create branches in Git, where you can find the branches in GitLab, and even how you can create a branch right in the GitLab interface.

Getting ready

You need to have a repository with at least one file, and commit changes in it. In the examples, I'll ...

Get GitLab Cookbook 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.