[英]What is the best way to fork wordpress git repository?
I am staring new Wordpress project. 我正在盯着新的Wordpress项目。 I want to use WP Github repository as a base and push it to my own repository.
我想使用WP Github存储库作为基础,并将其推送到我自己的存储库中。 But also I want to save link to original WP repository, switch branches on it and pull new updates.
但我也想保存到原始WP存储库的链接,在其上切换分支并提取新更新。 What is the best strategy for this?
最好的策略是什么?
Just set up the official repository as official
and your personal repository as personal
or origin
: 只需将官方存储库设置为
official
并将您的个人存储库设置为personal
或origin
:
git remote add official <official_remote>
then 然后
git remote add personal <personal_remote_path>
or 要么
git remote rm origin ;# remove the current origin, presumably the official one
git remote add origin <personal_remote_path>
You can then use git fetch official
and git merge
to pull in updates from the official repository, or you can set the proper upstream tracking branches with git checkout
. 然后,您可以使用
git fetch official
和git merge
从官方存储库中提取更新,或者可以使用git checkout
设置适当的上游跟踪分支。 For example: 例如:
git fetch official
git merge official/master
or 要么
git checkout -b official-master --track official/master
Just get a fork of the WP repository on GH then clone your fork not the WP repository. 只需在GH上获得WP存储库的分支,然后克隆您的分支而不是WP存储库即可。 Then you can add official as a remote
git remote add WP <the wp repo link>
. 然后,您可以将Official添加为远程
git remote add WP <the wp repo link>
。 If you want your own work private however just clone the WP repository and create a new remote for your private repo git remote add private <repo link>
. 如果您想将自己的工作设为私有,则只需克隆WP存储库并为您的私有仓库创建一个新的远程仓库
git remote add private <repo link>
。
You should in my opinion branch of your work off master and keep master in sync with WP repo. 在我看来,您应该脱离母版工作,并使母版与WP repo保持同步。 So
git checkout -b mybranch
will create a new branch based on master. 因此
git checkout -b mybranch
将基于master创建一个新分支。 When you want to sync your master you should just git fetch
and then git merge WP/master
on your own master. 当您想同步您的母版时,您应该只进行
git fetch
,然后在您自己的母版上git merge WP/master
master。
You should rebase your branch on master when you update it with git rebase master mybranch
使用
git rebase master mybranch
更新分支时,应基于master重新分支
WP through out the whole commands is an alias for the official branch remote name if you cloned the WP repo it would be origin 整个命令中的WP是官方分支远程名称的别名,如果您克隆了WP repo,它将是原始的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.