lördag 20 augusti 2016

github: fork, clone and sync

Problem: We have forked a repo. It's been updated and our fork is not in sync.

I assume that we have cloned the original repo to a local machine, and that we have added our private fork to the local clone. With mopidy repo as example (see also mopidy docs):

Creating local clone (creates a new folder - mopidy), and rename origin with upstream:
git clone https://github.com/mopidy/mopidy.git
git remote rename origin upstream

Check remote info:
git remote -v
>upstream https://github.com/mopidy/mopidy.git (fetch)
>upstream https://github.com/mopidy/mopidy.git (push)

Add privat github repo of mopidy:
git remote add alexjaw git@github.com:alexjaw/mopidy.git

Check remote info:
git remote -v
>alexjaw git@github.com:alexjaw/mopidy.git (fetch)
>alexjaw git@github.com:alexjaw/mopidy.git (push)
>upstream https://github.com/mopidy/mopidy.git (fetch)
>upstream https://github.com/mopidy/mopidy.git (push

Fetch to local clone (does not affect the local clone):
git remote update
>...

Merge updates in branch develop from original repo mopidy/mopidy (upstream):
git pull upstream develop

Finally, update your private repo branch develop (on Github):
git push alexjaw develop

Check on Github that the private repo is in sync with original repo.

Inga kommentarer:

Skicka en kommentar