84.13 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 add it to the remote upstream repository calling it upstream:

$ git clone git@github.com:mygit/pygymn.git 
$ cd pygymn
$ git remote add upstream https://github.com/yourgit/pygymn.git
$ git remote -v

You can fetch updates from the upstream repository:

$ git fetch upstream

We can view all branches including those from upstream:

$ git branch -va

Next, checkout your local main branch:

$ git checkout main 

Or create a new named branch (giving your branch its own simple informative name) within which to work:

$ git checkout -b newfeature

To merge updates from the upstream repository into your local repository see Section 84.19.

Once you have made your local changes, committed them and pushed to your repository, you can submit a pull request to the upstream repository through GitHub.



Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.