fork wordpress git 存储库的最佳方法是什么?

Ent*_*ast 0 git wordpress

我正在关注新的 WordPress 项目。我想使用 WP Github 存储库作为基础并将其推送到我自己的存储库。但我也想保存原始 WP 存储库的链接,在其上切换分支并提取新的更新。对此最好的策略是什么?

Chr*_*her 5

只需将官方存储库设置为official并将您的个人存储库设置为personalorigin

git remote add official <official_remote>
Run Code Online (Sandbox Code Playgroud)

然后

git remote add personal <personal_remote_path>
Run Code Online (Sandbox Code Playgroud)

或者

git remote rm origin ;# remove the current origin, presumably the official one
git remote add origin <personal_remote_path>
Run Code Online (Sandbox Code Playgroud)

然后,您可以使用git fetch officialgit merge从官方存储库中提取更新,或者您可以使用 来设置正确的上游跟踪分支git checkout。例如:

git fetch official
git merge official/master
Run Code Online (Sandbox Code Playgroud)

或者

git checkout -b official-master --track official/master
Run Code Online (Sandbox Code Playgroud)