Git useful commands
Repositories
Add new remote repository
git remote add <REMOTE_REPO_NAME> https://github.com/<OWNER>/<REPOSITORY>.git
In case of fork, it’s useful to add the original repo as a remote repo named ‘upstream’
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
Sync fork repo with original repo
First, fetch original repo
git fetch upstream
Then, switch to fork/branch to sync with original branch (eg. master)
git checkout master
Merge original/branch with fork/branch
git merge upstream/master
Finally, push synced fork/branch in remote fork/repo (eg. master)
git push origin master