2022-08-02 14:33:53 +00:00
|
|
|
#!bin/bash
|
|
|
|
profile=$(git config --global --get alias.profile | wc -l)
|
|
|
|
if [ $profile = "0" ]; then
|
|
|
|
git config --global alias.profile "!bash -c \"~/.git-switch-user \$1\""
|
|
|
|
else
|
|
|
|
echo "profile alias already defined in git"
|
|
|
|
fi
|
|
|
|
profileget=$(git config --global --get alias.profile-get | wc -l)
|
|
|
|
if [ $profileget = "0" ]; then
|
|
|
|
git config --global alias.profile-get "!bash -c \"git config -f ~/.git.d/\$1 --get \$2\""
|
|
|
|
else
|
|
|
|
echo "profile-get alias already defined in git"
|
|
|
|
fi
|
|
|
|
profileset=$(git config --global --get alias.profile-set | wc -l)
|
|
|
|
if [ $profileset = "0" ]; then
|
|
|
|
git config --global alias.profile-set "!bash -c \"git config -f ~/.git.d/\$1 \$2 \$3\""
|
|
|
|
else
|
|
|
|
echo "profile-set alias already defined in git"
|
|
|
|
fi
|
2022-08-02 15:07:34 +00:00
|
|
|
cp ./.git-switch-user ~/.git-switch-user
|
2022-08-02 14:33:53 +00:00
|
|
|
chmod +x ~/.git-switch-user
|
|
|
|
direx=$(ls ~/ -al| grep .git.d | wc -l)
|
|
|
|
if [ $direx = "0" ]; then
|
|
|
|
mkdir ~/.git.d
|
|
|
|
else
|
|
|
|
echo ".git.d already exists"
|
|
|
|
fi
|