View 3+ more - How do I update a GitHub forked repository?

github pull request command line / git / github / pull-request / git-fork

I recently forked a project and applied several fixes. I then created a pull request which was then accepted.

DennisLi



Answer #1

When you have cloned your forked repository, go to the directory path where your clone resides and the few lines in your Git Bash Terminal.

$ cd project-name

$ git remote add upstream https://github.com/user-name/project-name.git
 # Adding the upstream -> the main repo with which you wanna sync

$ git remote -v # you will see the upstream here 

$ git checkout master # see if you are already on master branch

$ git fetch upstream