I am staring new Wordpress project. I want to use WP Github repository as a base and push it to my own repository. But also I want to save link to original WP repository, switch branches on it and pull new updates. What is the best strategy for this?
Just set up the official repository as official
and your personal repository as personal
or 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
. 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. Then you can add official as a remote 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>
.
You should in my opinion branch of your work off master and keep master in sync with WP repo. So git checkout -b mybranch
will create a new branch based on master. When you want to sync your master you should just git fetch
and then git merge WP/master
on your own master.
You should rebase your branch on master when you update it with git rebase master mybranch
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.