Skip to content

Instantly share code, notes, and snippets.

@jrolfs
Created August 28, 2019 17: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 jrolfs/4949c4097317cdd7fe5b0416032561a9 to your computer and use it in GitHub Desktop.
Save jrolfs/4949c4097317cdd7fe5b0416032561a9 to your computer and use it in GitHub Desktop.
add-fork () {
local source_remote=${1:-upstream}
local source_url=$(git remote get-url $source_remote)
local target_user=${2:-jrolfs}
local target_remote=${3:-origin}
local target_url=$(sed "s/:.*\//:$target_user\//" <<< $source_url)
git remote add $target_remote $target_url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment