Auto merge
Add remote repository
# cd <forked-repo> # git checkout #git remote add upstream <upstream-repo-git-link> #
git fetch upstream
Updating fork from remote repo
# git pull upstream <upstream-branch>
Example (This is what I did to sync from remote branch and push to forked repo)
# cd <forked-repo> # git checkout #git remote add upstream <upstream-repo-git-link>
# git fetch upstream # git pull upstream master --rebase
As local repo changes are rebased, faced error while pushing changes to forked repo. Runt these commands to rebase changes for forked branch.
# git pull --rebase # git push origin <forked-remote-branch>
Force Update
If normal merge doesn’t wok and you are ready to do force update of your forked repo branch with original repo branch:
#git remote add upstream <upstream-repo-git-link>
# git fetch upstream
# git checkout <upstream branch>
# git reset --hard upstream/<upstream-branch>
# git push origin <forked-remote-branch> --force