简体   繁体   English

如何将所有分支与主分支合并?

[英]How to merge all branches with the master branch?

I have a few branches locally and want to update them. 我在本地有一些分支机构,想要更新它们。 How to merge the stuff from master branch into all other branches? 如何将主分支中的内容合并到所有其他分支中?

#!/bin/bash

git checkout master
git pull

branches=()
eval "$(git for-each-ref --shell --format='branches+=(%(refname))' refs/heads/)"

for branch in "${branches[@]}"; do
   branch=`expr substr $branch 12 100`
   git checkout $branch
   git merge master
done

git checkout master

Assuming that you branched off of master: 假设您是从master分支出来的:

git checkout my_branch
git rebase master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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