bunteshaus.de/push.sh
2022-06-26 20:13:20 +02:00

40 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# check if user has configured a name in git and set it, if not
if ! grep name ~/.gitconfig && ! grep name ~/.git/config; then
echo "You need a name! It is not important. If you choose none, it will be 'buha'."
echo "Write 'exit' or press 'Strg+c' to cancel."
read -p ": " name
if [ "${name}" == "exit" ]; then
exit
fi
if [ "${name}" == "" ]; then
name="buha"
fi
git config user.name "${name}"
fi
# check if user has configured an email address in git and set it, if not
if ! grep email ~/.gitconfig && ! grep email ~/.git/config; then
echo "You need an email! It is not important. If you choose none, it will be 'info@bunteshaus.de'."
echo "Write 'exit' or press 'Strg+c' to cancel."
read -p ": " email
if [ "${email}" == "exit" ]; then
exit
fi
if [ "${email}" == "" ]; then
email="buha"
fi
git config user.email "${email}"
fi
if ! grep rebase ~/.gitconfig && ! grep rebase ~/.git/config; then
git config pull.rebase true
fi
# update from upstream/main
git pull --rebase upstream main && \
# send own changes
git push origin