22 行
315 B
Bash
可执行文件
22 行
315 B
Bash
可执行文件
#!/bin/bash
|
|
|
|
if [ ! -d ".git" ]; then
|
|
echo "err: not a git repository"
|
|
exit
|
|
fi
|
|
|
|
url=$(git remote -v | grep fetch | sed 's/\t/ /g' | cut -d' ' -f2 | sort | uniq)
|
|
lines=$(echo "$url" | wc -l)
|
|
dir=$(pwd)
|
|
|
|
if [ "$lines" != "1" ]; then
|
|
echo "err: too many remotes"
|
|
exit
|
|
fi
|
|
|
|
cd ..
|
|
rm -rf $dir
|
|
git clone $url
|
|
cd $dir
|
|
|