Branching offers a way to work on a new feature without affecting the main codebase. Git’s branching functionality allows the creation of new branches in a project.
These new branches can then be used to test changes to code without affecting the main project code. If the changes work, the branch can be merged back with the main branch.
Use the following command to view current branches in the code repository:
The following command makes a new branch in the code repository:
git branch <branch-name>
The following command allows you to switch to a branch:
git checkout <branch-name>
To push the new branch to Git, we can use the following command:
git push origin <branch-name>
View all Courses