简体   繁体   中英

git merge with tracking all changes

I have branch master containing those commits :

C1
C2
C3

then I created branch B1 from master containing those commits

B1
B2
B3

how can I put now B1 in the head of master and keeping all commits like this :

C1
C2
C3
B1
B2
B3

I think this will do what you want...

# Make sure you have the lastest master
git fetch
git checkout master
git rebase origin/master

# Make sure B1 sits atop the lastest master
git checkout B1
git rebase master

# (Fast-forward) Merge back to master
git checkout master
git merge B1
git checkout master
git merge B-branch

// solve conflicts if they are

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