Skip to content

Instantly share code, notes, and snippets.

@illnyang
Forked from benschw/git-origins.md
Created December 26, 2016 17:22
Show Gist options
  • Save illnyang/f9470b3bd3c180b0c5fa06ab35efc148 to your computer and use it in GitHub Desktop.
Save illnyang/f9470b3bd3c180b0c5fa06ab35efc148 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