简体   繁体   English

更新/维护分叉git存储库的工作流程

[英]Workflow for Updating/Maintaining a forked git repository

I have forked a repo for adding some changes to the project; 我已经为该项目添加了一些更改而创建了一个仓库。 its a Vim plugin. 它是一个Vim插件。 I am planning to use my forked repo as the source for Vundle. 我打算将叉式存储库用作Vundle的源。 But I would also like to get updates from the original repo if any in the future. 但是我也希望将来从原始存储库中获取更新。

How should I go about maintaining the repo? 我应该如何维护回购协议?

  • I have changes in a new branch; 我在新分支中有更改; should I merge it? 我应该合并吗?
  • If I don't merge it, I will have to manually switch to that branch after Vundle cloning the repo. 如果不合并,在Vundle克隆存储库后,我将不得不手动切换到该分支。
  • If I merge it, how do I receive updates from the original repo? 如果合并,如何从原始存储库接收更新? The master would have changed. 主人会变了。 Will it get added as a new branch? 它将被添加为新分支吗?
  • It would be great if someone can get some pointers to articles or suggest how I should search for solutions/best practices; 如果有人可以找到一些文章的指导或建议我应该如何寻找解决方案/最佳实践,那将是很好的; my searches are picking trashes for a sometime (probably, I have no ideas regarding exact naming of stuff here). 我的搜索一段时间以来一直在捡垃圾(可能是,我对此处的确切名称一无所知)。

note: 注意:

  • I am new to git and Vim. 我是git和Vim的新手。

If you're improving the plugin, the best solution might be to propose your patch to the owner of the original repo. 如果您要改进插件,最好的解决方案可能是向原始存储库的所有者提出补丁。

If you can't or don't want to do it, you could either keep it in a dev branch or in your master . 如果您不能或不想这样做,则可以将其保留在dev分支或master It won't make any difference: either way you'll have to do a merge between your branch and origin/master every time you'll want to retrieve update from upstream. 不会有任何区别:无论哪种方式,每次您要从上游检索更新时,都必须在分支机构与origin/master之间进行合并。


Example: let's assume you want to keep it on your local master branch. 示例:假设您要将其保留在本地master分支上。 Then you would have: 然后您将拥有:

A ----------------- B
L origin/master     L master

where B is the commit you made with your modifications. 其中B是您所做的修改。

When you want to retrieve updates from upstream, using git fetch origin , you would end up with: 当您想使用git fetch origin从上游检索更新时,您将得到以下结果:

   ---- B
  /     L master
 /
A -- C -- D
          L origin/master

Then you'd just need to do, from your master branch: git merge origin/master , in order to get a commit with both your modifications and the updates 然后,您只需要在master分支中做: git merge origin/master ,以便同时进行修改和更新

   ---- B -- E
  /         /L master
 /         /
A -- C -- D
          L origin/master

As we can see, it would be easier if your changes could be accepted upstream. 如我们所见,如果您的更改可以在上游被接受,将会更加容易。 Not only could anyone benefit from it; 不仅任何人都可以从中受益。 it would also be much easier for you. 对您来说也将容易得多。

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

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