Skip to content

Instantly share code, notes, and snippets.

@m-wynn
Created September 4, 2015 02:00
Show Gist options
  • Save m-wynn/6a6b37db05a8257868b3 to your computer and use it in GitHub Desktop.
Save m-wynn/6a6b37db05a8257868b3 to your computer and use it in GitHub Desktop.
use this
#!/bin/zsh
add-remote() {
local name="$1"
local remote="$(git config --get remote.origin.url)"
local current="$(echo "$remote" | sed -e 's/.*github.com\://' -e 's/\/.*//')"
local url="${remote/$current/$name}"
git remote add "$name" "$url"
}
#usage `add-remote m-wynn`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment