Git Branching And Merging

Git Branching And Merging

Git Branching And Merging

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed different rollback scenarios in a git repository through a demo.

https://cloudaffaire.com/undo-changes-in-git-local-repository/

In this blog post, we will discuss how to branch and merge in git repository.

Git Branching And Merging:

Branching: Nearly every VCS has some form of branching support. Branching means you diverge from the main line of development and continue to do work without messing with that main line. In many VCS tools, this is a somewhat expensive process, often requiring you to create a new copy of your source code directory, which can take a long time for large projects.

Git supports branching and git branches is incredibly lightweight, making branching operations nearly instantaneous, and switching back and forth between branches generally just as fast. Unlike many other VCSs, Git encourages workflows that branch and merge often, even multiple times in a day. Understanding and mastering this feature gives you a powerful and unique tool and can entirely change the way that you develop.

Merging: Merging is the reverse of branching and in merging, branches are merged with the main line. Merging can occur in two way’s first forward merge and three way merge. Fast forward merging happens when two branches are connected directly and if there is no liner path between the two branches, three way merge occurs.  Data needs to be consistent in both branches in order to merge happen and if there is any inconsistency, merge conflict will appear.

Next, we are going to demonstrate git branching and merging with a demo.

Demo:

Hope you have enjoyed this article. In the next blog post, we will discuss git rebase.

To get more details on git, please refer below git documentation

https://git-scm.com/doc

 

Leave a Reply

Close Menu