[英]What is the best way to fork wordpress git repository?
我正在盯着新的Wordpress项目。 我想使用WP Github存储库作为基础,并将其推送到我自己的存储库中。 但我也想保存到原始WP存储库的链接,在其上切换分支并提取新更新。 最好的策略是什么?
只需将官方存储库设置为official
并将您的个人存储库设置为personal
或origin
:
git remote add official <official_remote>
然后
git remote add personal <personal_remote_path>
要么
git remote rm origin ;# remove the current origin, presumably the official one
git remote add origin <personal_remote_path>
然后,您可以使用git fetch official
和git merge
从官方存储库中提取更新,或者可以使用git checkout
设置适当的上游跟踪分支。 例如:
git fetch official
git merge official/master
要么
git checkout -b official-master --track official/master
只需在GH上获得WP存储库的分支,然后克隆您的分支而不是WP存储库即可。 然后,您可以将Official添加为远程git remote add WP <the wp repo link>
。 如果您想将自己的工作设为私有,则只需克隆WP存储库并为您的私有仓库创建一个新的远程仓库git remote add private <repo link>
。
在我看来,您应该脱离母版工作,并使母版与WP repo保持同步。 因此git checkout -b mybranch
将基于master创建一个新分支。 当您想同步您的母版时,您应该只进行git fetch
,然后在您自己的母版上git merge WP/master
master。
使用git rebase master mybranch
更新分支时,应基于master重新分支
整个命令中的WP是官方分支远程名称的别名,如果您克隆了WP repo,它将是原始的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.