How to fork and keeping your github repo in sync

Reading time ~1 minute

Forking a Github Repository

Just click “fork” button on upper right corner

black tea

Making a Local Clone

$ git clone

Adding a Remote

# list current configured remote repository for your fork
$ git remote -v

# add upstream
$ git remote add upstream

# list again to see upstream is added
$ git remote -v
origin (fetch)	
origin (push)
upstream (fetch)
upstream (push)

Working in a Branch

Create and checkout a feature branch. Personally, I like to set github issue number followed by summary of issue. This notation GH-${issue_num} will create a link to the issue on github.

$ issue_num=100
$ git checkout -b GH-${issue_num}_summary_of_issue

When ready, commit and push changes to GitHub.

$ git push origin GH-${issue_num}_summary_of_issue

Keeping Your Fork in Sync

$ git pull upstream master
$ git push origin master



Great tools to decided refnanice Continue reading

Smile every time you sudo

Published on February 18, 2021

Don't let your money sleep

Published on December 20, 2020