Skip to content

Instantly share code, notes, and snippets.

@LoganBarnett
Last active May 19, 2020 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LoganBarnett/b179e1f6d7a898879357c6128d339d80 to your computer and use it in GitHub Desktop.
Save LoganBarnett/b179e1f6d7a898879357c6128d339d80 to your computer and use it in GitHub Desktop.
Switch to using a git fork. Original "origin" becomes "upstream".
#!/usr/bin/env bash
# -*- shell-mode -*-
if [ "$1" == "" ]; then
echo "Usage: use-fork <forked clone URL>"
exit 1
fi
# Go to the repo involved and click fork
original_url="$(git remote get-url origin)"
git remote remove origin
git remote add origin $1
git remote add upstream $original_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment