Merge a Git Branch to a Master Branch

In this blog post, I will show you how to merge a git repository branch to a master branch.

Create a Branch

I will start by creating a new branch called Dev using the following command.

git branch Dev

After creating the new branch, I will check it out and add files to it.

git checkout Dev
Nano file4.ps1
git add .

After adding the files, I will commit it.

git commit -m "Add file4.ps1"


To merge the Dev branch, I will start by checking out the master branch.

git checkout master

Now, I can merge the Dev branch to the master branch with the following command.

git merge Dev

To delete the Dev branch, I will run the following command.

git branch -d Dev

Success! You're on the list.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.