更新我的github回购,这是从另一个项目中分出来的 [英] Update my github repo which is forked out from another project

查看:142
本文介绍了更新我的github回购,这是从另一个项目中分出来的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Child:项目分发给:这个。现在,我想用家长更新我的孩子最新更新。我可以这样做,如果是的话,怎么样?

I have forked out a Parent: project to Child: this. Now, I want to update my child with parents current updates. Can I do that, if yes how?

当我更新我的github回购时,我可以做一个git pull来更新我的本地回购。

When I update my github repo, then I can do a "git pull" to update my local repo.

推荐答案

在你的Child的本地克隆中,如果你愿意的话, b $ b

In your local clone of Child, pull from Parent, adding it as a remote if you like:

cd child
git remote add parent <parent-url>
git pull parent

父母的网址可以是公共github回购,或者您的它的本地克隆 - 当地的克隆当然会更快。如果您想要拉除父回购的当前HEAD以外的分支,只需添加一个参数(例如 git pull parent topic-branch )。如果这是一次性的事情,你可以跳过添加远程: git pull< parent-url> [分支]

The url of the parent could be the public github repo, or your local clone of it - the local clone will of course be faster. If you want to pull a branch other than the current HEAD of the parent repo, just add an argument (e.g. git pull parent topic-branch). If this is a one-time thing, you can just skip adding the remote: git pull <parent-url> [branch].

Pulling是获取和合并的组合,所以一旦你完成了,你就有了一个新的合并承诺你可能想在某个时候推回到你的公共回购。

Pulling is a combination of fetching and merging, so once you've done that, you've got a new merge commit you'll presumably want to push back to your public repo at some point.

这里的关键点,如果不明确,是从父母上游)存储库与从您的公共子系统,您当前的存储库中提取的资源无异。无论采用哪种方式,您都从具有一些通用历史记录的存储库中提取数据,并将其合并到当前分支中。当然,因为你正在合并,所以需要一个工作树 - 所以这是必须在你的本地回购中完成的事情。在github上托管的repo本质上是一种发布您在本地完成的工作的方式。所有你能做的就是推/拉,并浏览那里。

The key point here, in case it's not clear, is that pulling from the parent (upstream) repository is not different from pulling from your public clone of child, your current repository. Either way, you're fetching from a repository with some common history, and merging that into your current branch. And of course, since you're merging, a work tree is required - so this is something that must be done in your local repo. The repo hosted on github is essentially a way of publishing what you've done locally. All you can really do with it is push/pull, and browse what's there.

这篇关于更新我的github回购,这是从另一个项目中分出来的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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