bunteshaus.de/push.sh

27 lines
510 B
Bash
Raw Normal View History

#!/bin/bash
2022-06-26 18:30:52 +02:00
if ! git switch "${date}"; then
2022-06-26 18:33:16 +02:00
git switch -c ${date}
2022-06-26 18:30:52 +02:00
fi
2022-06-26 17:59:18 +02:00
2022-06-26 18:30:05 +02:00
date="$(date +%Y-%m-%d)-test"
2022-06-26 17:59:18 +02:00
changedfiles=$(git diff --name-status|awk '{print $2}')
2022-06-26 18:30:05 +02:00
set -x
2022-06-26 18:04:10 +02:00
git add . && \
git commit -m "${date}: ${changedfiles}" && \
2022-06-26 18:15:20 +02:00
git pull --rebase upstream main && \
2022-06-26 18:33:16 +02:00
git push --set-upstream origin origin/main && \
2022-06-26 18:04:10 +02:00
git switch main
2022-06-26 17:59:18 +02:00
exit
git add content/posts
2022-04-08 18:33:14 +02:00
git commit --amend --no-edit
target="origin"
2022-04-08 18:46:49 +02:00
force="-f"
2022-04-08 18:42:39 +02:00
if [ "$1" = "upstream" ]; then
2022-04-08 18:33:14 +02:00
target=upstream
2022-04-08 18:46:49 +02:00
force=""
2022-04-08 18:33:14 +02:00
fi
2022-04-08 18:46:49 +02:00
git push ${target} ${force}