Skip to content

Instantly share code, notes, and snippets.

@jawkha
Created March 1, 2019 06:54
Show Gist options
  • Save jawkha/6a4697633b171edcd120646d9045560e to your computer and use it in GitHub Desktop.
Save jawkha/6a4697633b171edcd120646d9045560e to your computer and use it in GitHub Desktop.
Useful Git commands for working with forks of other repos
To show all the remotes the repo is pointing to:
`git remote -v`
To add the upstream repo to the list of remotes:
`git remote add upstream <git@github.com:<repo-owner>/<repo-name.git>`
To fetch all the changes from upstream to the local repo:
`git fetch upstream`
To set up the master branch to track the remote master branch from upstream
`git branch --set-upstream-to=upstream/master master`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment