Git Branch - 8

What is Git Branch? 

Git branch actually your commits. But this commit has to keep a unique name. By defauld all commits keep in the main branch before we create any other branches. If you would like to checkout(move from the main branch to a new branch) to a new branch, you have to checkout with that branch name. Thats it. 
Suppose you want to add a new feature in your project but That feature you do not want to add with your main project now. Just you want to do the experiment separately. Once everybody feels it is good to go. Then you will add it to the main branch.

Git Architecture

The above architecture mentioned that Branch A was created from the Main Branch to fix the bug without hampering the main branch. Once the bug is fixed successfully, it merges with the main branch. Same Branch B was created from the main branch to add a new feature without hampering the main branch. Once it successfully works then merge with the main branch.

Initially, every branch is a copy of its parent branch. Here, the parent branch is not always the main branch.

Like. Main Branch > Branch A > Branch C
Here Branch A created from the Main Branch and Branch C was created from Branch A. Therefore, initially, Branch A is a copy of the Main branch and Branch C is a copy of Branch A.

In the next tutorial, we will create a new branch, modify it on a new branch, and finally, we will merge our new branch with the main branch.
 


Post a Comment

0 Comments