Update forked git repo on github – for Magento2

How to update a forked git repo on github - so it's up-to-date with the original from where it was forked. In other words, how to re-sync your fork with the original - as is needed when updating the Magento 2 code base.

Update your local repo with your remote on github :

git remote -v
origin https://github.com/thelettuce/magento2.git (fetch)
origin https://github.com/thelettuce/magento2.git (push)

git branch

git fetch

git pull

Add an upstream remote of where the fork is from :

git remote add upstream https://github.com/magento/magento2.git

git remote -v
origin https://github.com/thelettuce/magento2.git (fetch)
origin https://github.com/thelettuce/magento2.git (push)
upstream https://github.com/magento/magento2.git (fetch)
upstream https://github.com/magento/magento2.git (push)

Fetch upstream, checkout to your branch and merge it with upstream, then push back to github.

git fetch upstream

git checkout develop

git merge upstream/develop

git push origin

Github is now up to date!

Leave a Reply