Branch operation allows creating another line of development. We can use this operation to fork off the development process into two different directions. Branching is used in Version control and software management to maintain stability while isolated changes are made to code. Branching facilitates the development of bug fixes, the addition of new capabilities and the integration of new versions after they have been tested in isolation.
we can create a branch by using a command git branch branchName.
git branch text
To check either a branch is created or not command is git branch.
In above example, Git shows an asterisk mark before currently working branch.
We can switch between branches by using a command git switch branchName.
We can delete a branch by using a command git branch -D branchName. But before deleting the existing branch, switch to the other branch.
Merging is a common practice for developers using version control systems. Whether branches are created for testing, bug fixes, or other reasons, merging commits changes to another location. To be more specific, merging takes the contents of a source branch and integrates them with a target branch. In this process, only the target branch is changed. The source branch history remains the same.