bunteshaus.de/push.sh

27 lines
525 B
Bash
Raw Normal View History

#!/bin/bash
2022-06-26 17:59:18 +02:00
date="$(date +%Y-%m-%d)"
changedfiles=$(git diff --name-status|awk '{print $2}')
if ! git switch "${date}"; then
2022-06-26 18:19:22 +02:00
git switch -c ${date} origin/main
2022-06-26 17:59:18 +02:00
fi
2022-06-26 18:19:22 +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:19:22 +02:00
git push -f origin --set-upstream origin/"${date}" && \
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}