从master更新Git分支 [英] Update Git branches from master

查看:679
本文介绍了从master更新Git分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Git的新手,现在我处于这种情况:


  • 我有四个分支(master,b1, b2和b3)。
  • 在我完成b1-b3之后,我意识到我应该在其他所有分支上对分支主机进行更改。

  • 我在 master 中更改了我所需的内容,这里是我的问题:


如何使用 master 分支代码更新所有其他分支?

解决方案您有两种选择:

第一种是合并,但这会为合并创建额外的提交。



结帐每个分支:

  git结帐b1 

然后合并:

  git merge origin / master 

然后按下:

  git push origin b1 

或者,您可以做一个rebase:

  git fetch 
git rebase origin / master


I'm new to Git, and now I'm in this situation:

  • I have four branches (master, b1, b2, and b3).
  • After I worked on b1-b3, I realized I have something to change on branch master that should be in all other branches.
  • I changed what I needed in master and... here is my problem:

How do I update all other branches with master branch code?

解决方案

You have two options:

The first is a merge, but this creates an extra commit for the merge.

Checkout each branch:

git checkout b1

Then merge:

git merge origin/master

Then push:

git push origin b1

Alternatively, you can do a rebase:

git fetch
git rebase origin/master

这篇关于从master更新Git分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆