[GIT] Sync local fork with main repository

I very often use Github/Git for my and not only my projects and this post is something like memo for myself, but i think it can be useful for somebody else. SHow to sync your fork with main repository: First of all set new remote repo:
git remote add upstream https://github.com/user/repo.git
Now fetching last changes:
git fetch upstream
And now as we fetched the upstream repository, we must to merge its changes into our local branch.
git merge upstream/master