git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
git pull upstream master
git push origin master
Best-Practices while working with the forked repository:
-
If you want to make some changes into an app, prefer to create feature branches. i.e., Instead of making changes into your forked master-branch, make changes into your feature-branch.
-
Keep your remote/local forked master-branch synchronized before creating any Feature-Branch. (This hardly gives you any merged conflicts when you make a pull request, unless if other user is making the same changes you are making after your remote/local forked master-branch synchronized with original branch.)
Syncing Your GitHub Repo Reduces the Chances of a Merge Conflict
- A merge conflict occurs when two people edit the same line in a file. Git does not know how to resolve the conflict (i.e. which changes to keep and which to remove).
- When git does not know how to resolve a conflict, it will ask you to manually fix the conflict. If you sync your files regularly, you will ultimately reduce the risk of a merge conflict.
-
Keep your local/remote forked master-branch synced with the original master-branch before making any pull requests.
Original Master Branch: (Owner's/Upstream) master-branch from which you forked the repo.