A fork is a new repository that shares codes and visibility settings with an “upstream” repository. Forks are used to iterate on ideas, or maintain changes to a repository when a user does not have write access to upstream, or simply prefers to keep a personal copy.
How to fork a repository ๐
A repository can be forked from the GitHub.com page of the repository.
How to update the forked repository ๐
Add the remote, call it “upstream”.
git remote add upstream https://github.com/whoever/whatever.git
Fetch all the branches of that remote into remote-tracking branches.
git fetch upstream
Assuming that local changes are in the master branch, moving to this branch.
git checkout master
Rewrite the master branch so that any commits that aren’t already in upstream/master are replayed on top of the other branch.
git rebase upstream/master
Lastly, force push to the forked remote repository.
git push -f origin master