简体   繁体   English

如何使用原始项目的更改更新本地克隆的 git repo(没有 fork!)

[英]how to update locally cloned git repo with changes from the original project (no fork!)

I am a bit new to git so I may misuse git terminology in the following... Searching for a an answer I only found cases, where a fork (that is: another repo on github or similiar) was created - which I don't want (yet).我对 git 有点陌生,所以我可能会在下面误用 git 术语......寻找一个答案我只找到了创建叉子(即:github 或类似的另一个仓库)的情况 - 我不这样做不想(还)。 Or it least: This is the way I think I understood it....或者至少:这是我认为我理解它的方式......

What I want is: To clone a github repo of a project located on github onto my harddisk (already done).我想要的是:将位于 github 上的项目的 github repo 克隆到我的硬盘上(已经完成)。 Makeing changes to that cloned repo and don't put those online (because they are highly experimental in this moment).对克隆的 repo 进行更改,不要将它们放到网上(因为此时它们是高度实验性的)。 And I want to be able to update my cloned repo with changes made to the mother/father original repo on github without overwriting my changes (by risking conflicts from time to time...).而且我希望能够使用对 github 上的母/父原始存储库所做的更改来更新我的克隆存储库,而不会覆盖我的更改(不时冒着冲突的风险......)。

Is this possible and how can I accomplish this?这是可能的,我怎样才能做到这一点?

There is no significant difference if you use a fork (different remote ) or the original repository ( origin ) while synchronizing the remote changes to your local branch.如果在将远程更改同步到本地分支时使用 fork(不同的remote )或原始存储库( origin ),则没有显着差异。 What you are trying to achieve is a common git workflow routine and you can get it either by git pull command or git pull --rebase .您要实现的是一个常见的 git 工作流程例程,您可以通过git pull命令或git pull --rebase获得它。 The final outcome will be the same from your perspective - you will keep your local changes (commits) and you will be up-to-date with the remote changes at the same time.从您的角度来看,最终结果将是相同的 - 您将保留本地更改(提交),同时您将与远程更改保持同步。 However, the history log can be slightly different.但是,历史日志可能略有不同。 See the question if you want to dive into the details.如果您想深入了解细节,请参阅问题

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

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