简体   繁体   English

git:如何将原始分支合并到我的分叉仓库中?

[英]git: how merge an original branch into my forked repo?

I've a repo with a master branch 我有一个主分支的仓库

I've forked this repo 我已经分叉了这个仓库

Now I nee to merge updated originale repo into my forked branch. 现在,我需要将更新的原始回购合并到我的分支分支中。

How to ?! 如何 ?!

Your forked repo, let's say git://realtebo/project.git is your current origin remote, you need to add another remote, which we can call source 您的分叉存储库,假设git://realtebo/project.git是您当前的origin远程git://realtebo/project.git ,您需要添加另一个远程git://realtebo/project.git ,我们可以将其称为source

git remote add source git://source/project.git

Now you can explicitly pull from source 现在您可以显式地从源中提取

git pull source master

And then push to your forked origin 然后推到你的分叉起源

git push origin master

Edit accordingly to your branches name. 相应地编辑为您的分支机构名称。

Supposing that the original repro has the name upstream 假设原始repro在upstream具有名称

git checkout  master
git fetch upstream
git merge -ff upstream/master

ff tells git to fast-forward if that is possible and not to create a merge commit ff告诉git如果可能的话快进并且不创建合并提交

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

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