home/bin/git-new-push-remote (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 |
#!/bin/sh
# git new-push-remote: adds a new push-only remote to a repository
# without removing the existing push remote.
[[ "$@" == "" ]] && {
printf '%s\n' "usage: git new-push-remote <remote url>"
exit
}
old_push_remote="$(git remote -v | grep '(push)' | awk '{print $2}')"
git remote set-url "$(git remote show)" --add --push "$1"
git remote set-url "$(git remote show)" --add --push "$old_push_remote"
|