简体   繁体   English

维护主服务器中带有补丁的分叉

[英]Maintaining a fork with patches in master

I want to maintain a fork with custom functionality added on top of the original code. 我想维护一个在原始代码之上添加了自定义功能的分支。 It is not a contribution to the project itself and won't be merged upstream. 这不是对项目本身的贡献,不会在上游合并。

What I want to achieve: 我要实现的目标:

  • The GitHub page of the fork should point to the patched version of the project instead of the original one. 分支的GitHub页面应指向项目的修补版本,而不是原始版本。
  • I should be able to easily merge new upstream code while preserving a separate history for my own commits. 我应该能够轻松合并新的上游代码,同时为自己的提交保留单独的历史记录。

My current plan is to have the upstream/master branch in the fork repository as vendor , from which my own master will be branched. 我当前的计划是让fork库中的upstream/master分支作为vendor ,从中分支我自己的master Whenever there is a stable release upstream I can pull & push it into the vendor branch and than rebase my master . 每当上游有稳定的发行版时,我都可以将其拉入并推入vendor分支,而不是重新调整master

Questions: 问题:

  1. Is there an easier or cleaner way to achieve the same results? 有没有更简单或更干净的方法来达到相同的结果?
  2. Should I fork via GitHub web-interface and then move master , or should I create the repository locally as described in this answer ? 我应该通过GitHub Web界面分叉然后移动master ,还是应该按照此答案中的描述在本地创建存储库?

A fork is just a more formal way to link those two GitHub repo. fork是链接这两个GitHub存储库的更正式的方式。

You don't even need to name upstream/master as "vendor": you can directly rebase your own master branch on top of that remote branch. 您甚至不需要将上游/主服务器命名为“供应商”:您可以直接在该远程分支之上重新建立自己的主分支。

git fetch upstream
git checkout master
git rebase upstream/master

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

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