简体   繁体   中英

How to 'synchronize' master and development branches?

Someone merged our development branch next into our master branch. Now next is one commit behind master .

Our feature branches come from next , and we merge back to next from them.

I'm concerned that next will diverge from master if I merge feature1 into next . There are multiple feature branches.

How do I 'synchronize' next and master , so that I can merge feature1 into next and 'synchronize' feature2 to next afterwards?

I'm using 'synchronize' to signify merge , rebase , etc.

UPDATE:

What is confusing me is that normal is behind master . The files are the same. It appears to be a commit created for the pull request merge. My concern is that next and master will have a mixed divergence

master: A <--B
              \
next:   D <--- C

A is the merge commit. D is a commit on next after the merge commit. So, then master and next have commits not on the other. Does that matter?

This is a normal git flow , and is nothing to be worried about.

Feature branches should branch off of develop (in your case next ), and merge into master at some point (usually on each new release or version). It's common for develop and master to diverge; develop should almost always be ahead of master . You should only ever be pushing to master when there's a new release or a hotfix.

Branch your feature branches off of develop , and once you are happy with the changes, merge the feature branches back to develop . Once you are ready for release, and have ensured that none of the feature branches have conflicts with each other, you can merge develop back to master . This will bring all of the changes from each feature branch into master .

Your two branches currently look like the following:

next     ------ A -
                    \
master   ------ A -- B

As you merge feature branches into next :

feature2 -----------------
                           \
feature1 --------------     \
                       \     \
next     ------ A -  -- C --- E -- G -
                    \                  \
master   ------ A -- B --- D --- F ---- H

Hopefully the above ASCII diagram helps illustrate this, though a number of helpful picture diagrams illustrating git flow can be found at GitHub .

Hope this helps! :)

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