Progressive Full Stack Application Development with Live Projects

Source Code Management

Git Branching

In Git, a branch is a new or separate version of the main repository.

Branches allows us to work on different parts of a project without impacting the main branch.

When the work is complete, a branch can be
merged with the main project.

We can even switch between branches and work on different projects without them interfering with each other.

Making a new Git Branch

				
					$ git branch 

				
			

Checking all available Branches

				
					$ git branch
				
			

Switching to other Branches

				
					$ git checkout 
				
			

Making a new branch and directly switching to it

				
					$ git checkout -b 
				
			

Deleting a Branch

				
					$ git branch -d 
				
			

Merging two Branches

It’s preferred to change/switch to master branch before any branch
needs to be merged with it.

				
					$ git merge 
				
			

This will merge the specified branch with our master branch.