Create a branch
Creating a branch in Git empowers you to work on new features, tackle bug fixes, or experiment with changes without jeopardizing the stability of the main codebase. Think of branches as isolated workspaces where you can freely make changes, commit your work, and collaborate with others, all while keeping the main branch intact.
In this part of our tutorial, you will create a new branch in Git and start working on your own line of development.
Use the git branch command to create your first new branch and name it issue1
.
$ git branch issue1
If you do not specify any parameters, the branch command lists all branches corresponding to the repository. The asterisk indicates the active branch.
$ git branch
issue1
* main
Now, the history looks like this: