Update Git branches from master -git update branch from master

DevOps

I'm new to Git, and now I'm in this situation:

I have four branches (master, b1, b2, and b3).

After I worked on b1-b3, I realized I have something to change on branch master that should be in all other branches.

I changed what I needed in master and... here is my problem:

How do I update all other branches with master branch code?


If you want to unleash your potential in this competitive field, please visit the DevOps course page for more information, where you can find the DevOps tutorials and DevOps frequently asked interview questions and answers as well.

2
Answers

Replies

You can use the rebase command. It maintains the linear history in all branches. Execute the following commands.



git fetch


git rebase origin/master

 

You have to check if there are any unstaged changes. 



git checkout b1



Merge the files to the origin



git merge origin/master



Push the branch.



git push origin b1



Follow the same process for b2 and b3 branches.

 
 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
WhatsApp
To Top