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

35 lines
894 B
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
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
# update from upstream/main
git pull --rebase upstream main && \
# send own changes
git push origin