- syncing with the main repo if we already have changes is a pain
- define
remoteOrigin
(the external remote name of the root repo) - define
ownOrigin
(the remote name of our fork) - define
syncBranch
(the branch which we will get in sync)
- remember the current branch
- stash all current local changes
- switch to the branch we want to sync
- fetch all changes
- pull all changes on the branch to get in sync from the original remote
- push all changes to the forked remote
- switch branch to the original one
- reapply stashes
- WIN! :D
- execute this shell script inside the git repo you want to get in sync
./gitSync.sh