You are looking to contribute to an awesome project on GitHub and you finally find it and fork the repo. a few weeks later you worked on the forked repo but are afraid the fork is way behind the original repo. how would you keep it up to date? here is how
Below are the steps to always keep the forked repo up to date with its original repo
1.Add the remote/original repo and lets call it upstream
$ git remote add upstream https://github.com/original-repo/repo-name.git
2.Fetch all branches from remote upstream
$ git fetch upstream
3.Use git rebase to re-write your master with upstreamโs master. Note: rebase will fail, if you have uncommitted changes in your forked master
$ git rebase upstream/master
4.Push your updates to master using force
$ git push origin master --force
Top comments (0)