You are currently viewing Merge main branch with other branch in git

Merge main branch with other branch in git

We have “demo” branch. So lets merge the demo branch with main branch. If you want to create a main branch refer to this post.

Lets see how to merge.

git checkout main

This will switch to main branch in your git.

git merge demo

This will fast-forward merge the main branch with demo branch. As the main branch and demo branch are same there is no need of duplicate branch so we can just delete the demo branch.

git branch -d demo

Type the code below to see the status of the git.

git status

Leave a Reply