Update Git branches from master
Posted By: Anonymous
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?
Solution
You have two options:
The first is a merge, but this creates an extra commit for the merge.
Checkout each branch:
git checkout b1
Then merge:
git merge origin/master
Then push:
git push origin b1
Alternatively, you can do a rebase:
git fetch
git rebase origin/master
Answered By: Anonymous
Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.