2017-07-24 01:11:28 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2017-07-24 21:14:50 +02:00
|
|
|
if [[ "--help" == "${1}" ]]; then
|
|
|
|
echo "bash ./sgit user.email commit"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${2}" ]]; then
|
2017-07-24 21:26:23 +02:00
|
|
|
echo "Bitte email und commit angeben!!!"
|
2017-07-24 21:14:50 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-02-17 16:55:56 +01:00
|
|
|
push="${3}"
|
|
|
|
[[ -z "${push}" ]] && push="origin"
|
|
|
|
|
2019-08-02 14:46:53 +02:00
|
|
|
branch="${4}"
|
|
|
|
[[ -z "${branch}" ]] && branch="master"
|
|
|
|
|
2020-03-10 09:25:39 +01:00
|
|
|
git config --global core.editor "vim"
|
2017-07-24 21:14:50 +02:00
|
|
|
git config --global user.email "${1}"
|
2017-08-06 16:58:33 +02:00
|
|
|
git config --global user.name "${1}"
|
2018-01-19 18:57:13 +01:00
|
|
|
git config --global push.default simple
|
2020-03-10 09:25:39 +01:00
|
|
|
git config --global credential.helper store
|
2019-08-02 14:50:23 +02:00
|
|
|
git config --local core.sshCommand "ssh -i $HOME/.ssh/id_rsa"
|
2020-03-10 09:25:39 +01:00
|
|
|
#git branch --set-upstream-to=origin/master master
|
2017-07-27 02:31:57 +02:00
|
|
|
git status
|
2017-07-24 01:11:28 +02:00
|
|
|
git add --all
|
2017-07-24 21:14:50 +02:00
|
|
|
git commit --all -m "${2}"
|
2017-07-24 01:11:28 +02:00
|
|
|
git show
|
2020-03-10 09:25:39 +01:00
|
|
|
if ! GIT_SSH_COMMAND="ssh -oPort=1022" git pull "${push}" "${branch}"; then
|
2019-08-02 14:46:53 +02:00
|
|
|
echo "Konnte keine neuen Daten vom Server hollen!!!"
|
|
|
|
fi
|
2020-03-10 10:32:35 +01:00
|
|
|
if ! GIT_SSH_COMMAND="ssh -oPort=1022" git push --set-upstream "${push}" "${branch}"; then
|
2019-08-02 14:46:53 +02:00
|
|
|
echo "Konnte keine neuen Daten zum Server pushen!!!"
|
|
|
|
fi
|
2017-07-24 01:11:28 +02:00
|
|
|
git status
|
2020-03-10 09:28:27 +01:00
|
|
|
if ! GIT_SSH_COMMAND="ssh -oPort=1022" git pull "${push}" "${branch}"; then
|
|
|
|
echo "Konnte keine neuen Daten vom Server hollen!!!"
|
|
|
|
fi
|