Skip to content

Instantly share code, notes, and snippets.

@pandorasNox
Forked from benschw/git-origins.md
Created June 15, 2018 14:15
Show Gist options
  • Save pandorasNox/d1560cf28d58997be55e511b0030d765 to your computer and use it in GitHub Desktop.
Save pandorasNox/d1560cf28d58997be55e511b0030d765 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