bunteshaus.de/push.sh

40 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/bash
2022-06-26 18:35:58 +02:00
2022-06-26 20:11:27 +02:00
# 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
2022-06-26 20:13:20 +02:00
# check if user has configured an email address in git and set it, if not
2022-06-26 20:11:27 +02:00
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
2022-06-26 20:13:20 +02:00
if ! grep rebase ~/.gitconfig && ! grep rebase ~/.git/config; then
git config pull.rebase true
fi
2022-06-26 19:44:15 +02:00
# update from upstream/main
2022-06-26 18:15:20 +02:00
git pull --rebase upstream main && \
2022-06-26 19:44:15 +02:00
# send own changes
git push origin