Skip to content

Instantly share code, notes, and snippets.

@osiriswrecks
Forked from benschw/git-origins.md
Created June 20, 2019 04:45
Show Gist options
  • Save osiriswrecks/cce14e08d1395ea1438b88bb03fa1162 to your computer and use it in GitHub Desktop.
Save osiriswrecks/cce14e08d1395ea1438b88bb03fa1162 to your computer and use it in GitHub Desktop.
fork a repo manually (set source as upstream origin) rather than with the "fork" button. e.g. for in github when you want to fork a project twice.

Ripped off from adrianshort.org

List curent remotes

$ git remote -v

origin  https://github.com/hakimel/reveal.js.git (fetch)
origin  https://github.com/hakimel/reveal.js.git (push)

Rename origin to upstream and add our new empty repo as the origin.

$ git remote rename origin upstream
$ git remote add origin https://github.com/benschw/new-presentation.git
$ git remote -v

origin  https://github.com/benschw/new-presentation.git (fetch)
origin  https://github.com/benschw/new-presentation.git (push)
upstream    https://github.com/hakimel/reveal.js.git (fetch)
upstream    https://github.com/hakimel/reveal.js.git (push)

Push from your local repo to your new remote one.

$ git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment