mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
21 lines
420 B
Bash
Executable file
21 lines
420 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
old=$1
|
|
new=$2
|
|
|
|
test -z $old && echo "old remote name required." 1>&2 && exit 1
|
|
test -z $new && echo "new remote name required." 1>&2 && exit 1
|
|
|
|
if ! git config --get "remote.$old.fetch" > /dev/null; then
|
|
echo "remote $old doesn't exist"
|
|
exit 1
|
|
fi
|
|
|
|
if git config --get "remote.$new.fetch" > /dev/null; then
|
|
git remote remove $new
|
|
fi
|
|
git remote rename $old $new
|
|
git remote -v
|