Home > Blockchain >  How to update changes from Master branch to current branch
How to update changes from Master branch to current branch

Time:10-05

This question may be duplicated ,but I did not find answer from other questions.

I have 3 branches:

 BranchA 
 
 master branch

 BranchB

First I clone code from master to BranchA,and wrote code in BranchA.

But during I was coding in BranchA ,master branch code changed ,since other coders was coding at BranchB and then merged BranchB to master branch.

How can I update BranchA from the merged master branch before I merge it to master branch ?

CodePudding user response:

Is this while working on a remote branch? Let's assume so.

If remote master received new changes, you can merge these changes in your clone of master as follows. First, checkout your own master:

git checkout master

Then fetch the remote changes

git fetch upstream

and apply them to your local master,

git rebase upstream/master

If that didn't give you any issues, simply go to your branchA

git checkout branchA

and apply the changes in this branch

git rebase master

Now, branchA should be up to date with the remote master including changes made by third person in branch branchB.

  • Related