简体   繁体   中英

Sync all remote branches on a git repository

Let's say there's a repository with the following branches:

  • master
  • module1changes
  • module2changes

Every so often builds are released where the master branch pulls in changes from all the other branches, increments the version number and pops out binaries, then syncs all the branches to be up-to-date with master. Then the cycle repeats and developers continue pushing to the other branches. Only one person pulls into master. This is the workflow I was hoping to accomplish. What's the easiest way to sync all of the branches when I pull everything into master? Just checkout branch, pull from remote master, push to branch, switch to the next one?

Assuming your local master is up to date with the remote master, you can just merge the local master into the module branches.

# Release
git checkout master
git merge module1changes module2cjhanges
git tag xxx
git push origin master
git push --tags origin

# Update module branches
git checkout module1branch
git merge master
git push origin module1branch
git checkout module2branch
git merge master
git push origin module2branch

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