Discover the Magic of Git Branches: How to Make Your Code Work Like a Wizard!

sourabh patelsourabh patel
2 min read

Table of contents

What are git branches

Consider git provides you with a line of development, Branches are a separate line of development within the git repository. Each branch has its own changes & modification & these changes do not effect other branches within the same repository .

Use of branches unable multiple developer working on the same codebase simultaneously as well as manage code base, bugs & fixes , features & vulnerability patchs.

when you create a git repository following things happen :

  1. The default branch is created by the name of main/master

  2. developers create multiple branches as per the need

  3. when a new branch is created it is a copy of the code from the branch it was created.

  4. any changes made to perticular branch will only affect the new branch and will not affect master branch

  5. branches are merged back to the main branch once code is completed

  6. The main branch is considerd as stable/production and the changes should only be added to stable branch

Summary: Git branches allow for multiple lines of development within a single repository. Each branch has its own unique changes and modifications, and changes made to one branch do not affect others. This allows for multiple developers to work on the same codebase, manage bugs, fixes, and patches. The default branch is typically called main or master, and new branches are created as needed, starting as a copy of the original code. Branches are merged back to the main branch when the code is complete, and the main branch is considered stable and used for production.

to learn git branching without doing with real projects so you can get gist of it:

learn git branching website

clickt the link above

0
Subscribe to my newsletter

Read articles from sourabh patel directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

sourabh patel
sourabh patel