简体   繁体   中英

How to update changes from Master branch to current branch

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM