Member-only story
How To Manage Branches in Your GitHub Repository
An overview to create, switch, and delete a branch
This post continues with the story How To Update Your GitHub Repository in Visual Studio Code. In the previous post, I explained how to clone your GitHub repository on VS Code, commit and push changes, and make a pull request. These are fundamental operations when working in a team.
But there was another topic which wasn’t covered — the management of branches. As you know, when you create a GitHub repository, a branch is automatically created and is called main. This default branch displays the official code of the repository. Intuitively, you would directly work on the main branch, but it can become messy when working with other people.
If you and another teammate work on the same branch, it can create only confusion since everyone has a different way of thinking. For this reason, there is the exigence of alternative branches: there should be the main branch, while at the same time, each person within the team should work on a different branch.
In this way, there is always a copy of the original code, and eventually, you can merge the changes of your alternative branch into the main branch through a pull request. Let’s begin this tutorial!