github从fork同步 [英] github sync from fork

查看:70
本文介绍了github从fork同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对github很陌生。

I am pretty new to github.

我从第三方制作了一个fork,然后修改了这个fork中的几个文件并提交给我的fork。根据我的叉子,我做了一个分支。

I made a fork from a third party, then I modified several files in this fork and committed to my fork. Based on my fork, I made a branch.

我注意到上游有一些更新(我制作了fork的第三方源),所以我同步了fork。现在如何将更改从分支推送到分支?

I noted there are some update in upstream (the third party source which I made the fork), so I sync my fork. Now how do I push the changes from my fork to my branch ?

另一种情况是在分支中进行了一些更改之后,如何将它们重新推送到分支?

Another situation is after I made some changes in my branch, how do I push them back to my fork?

推荐答案


基于我的叉子,我做了一个分支。我注意到上游有一些更新(我制作了fork的第三方源),所以我同步了fork。现在,如何将更改从我的fork推送到我的分支?

Based on my fork, I made a branch. I noted there are some update in upstream (the third party source which I made the fork), so I sync my fork. Now how do I push the changes from my fork to my branch ?

实际上,如果您添加了一个引用原始仓库的遥控器,您可以执行以下操作:

Actually, if you have added a remote referring to the original repo, what you do is:

 git remote add upstream /url/original/repo
 git fetch upstream
 git checkout your-pr-branch
 git rebase upstream/master
 git push --force

此假设您的分支机构是从上游回购完成的master 分支。

您还可以将上游/ master 拉入 master 并在您想同步叉子的情况下将 master 推入叉子。

This assume your-pr-branch was done from the upstream repo master branch.
You can also pull upstream/master into master and push master to your fork if you want to sync your fork.

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

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