GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Git Fork a Repository |
20190611 A common workflow is to fork someone's original repository, make changes, and submit a pull request to the original repository for them to consider incorporating it into their main code base. You can fork the original repository through the github interface.
Once forked, clone the fork to your local machine and link it to the upstream repository:
$ git clone git@github.com:gjwgit/pygymn.git $ cd pygymn $ git remote add upstream https://github.com/simonzhaoms/azface.git $ git remote -v |
Fetch updates from the upstream repository:
$ git fetch upstream |
We can view all branches including those from upstream:
$ git branch -va |
Now checkout your local main branch and merge from the upstream repository:
$ git checkout main $ git merge upstream/main |
You may want to create a new named branch (give your branch its own simple informative name) within which to work, though this is optional:
$ git branch newfeature $ git checkout newfeature |
Once you have made your local changes, committed them and pushed to your repository, you can submit a git pull request to the upstream repository.