Another Japan in the World

Jun Aruga's blog, who lived in Japan, Singapore, live in Czech Republic. Mainly about IT and travel.

How to synchronize your forked repository

Synchronize your repository forked from other upstream repository, with the upstream repository.

For example,

I forked from .
My forked repository is .

I want to synchronize 's modification.

$ cd $GIT_DIR/localmemcache
$ git remote -v
origin (fetch)
origin (push)

Add the repository: as "upstream".

$ git remote add upstream
$ git remote -v
origin (fetch)
origin (push)
upstream (fetch)
upstream (push)

Get latest modification from the upstream repository's master branch.
You can see the local source is updated.

$ git pull upstream master

$ git log

Finally to synchronize your github repository with upstream repository.

$ git push origin master

That's all.