git: Move checked out upstream repo to forked repo
Use case: you have checked out a repo. then forked it and now want to checkout the fork without downloading everything again.
Solution:
$ git remote rename origin upstream $ git remote add origin git@github...my-fork $ git fetch origin $ git push origin $ git branch --set-upstream-to=origin/master master