Wednesday, May 7, 2014

How to sync forked repos

Assume you are working on a forked repo and want to keep it synced with original one where you forked. But it is not limited to forked repos, it should be any two repos you want to merge together (Of cause you have to solve the conflict by yourself with your way).

  • Create a mirror repo for sync

git clone --mirror  [local_repo_name]
git remote add --mirror=fetch upstream

  •  Sync

git fetch --all -v --progress
git push --mirror -v --progress origin

  • Auto Sync
          You can add it to "cron" if you want it to be synced automatically. Not good at it. Maybe some would like to help me work out the syntax for it.

Job done. Hope simple python script would come soon.