Skip to content

Instantly share code, notes, and snippets.

@jtbonhomme
Forked from benschw/git-origins.md
Created October 29, 2018 10:55
Show Gist options
  • Save jtbonhomme/6f4df186395bd713d3e98d5352cbea4e to your computer and use it in GitHub Desktop.
Save jtbonhomme/6f4df186395bd713d3e98d5352cbea4e 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