This is how I currently auto-push changes to my work/lab journal repo. It works across multiple systems with minimal clashes (in part because I don't switch devices or edit journal in multiple places concurrently, perhaps). $EDITOR takes care of asking me to resolve conflicts (and shows git diff when appropriate).
I've put it here to share and to invite input on how it might be improved.
In reply to https://twitter.com/majorhayden/status/1446179887606386689
#!/bin/bash
#
JOURNAL_PATH=/path/to/journal
DATE=$( date +"%Y-%m-%d %H:%M" )
HOSTNAME=$( hostname )
BRANCH=main
cd $JOURNAL_PATH
git add -A .
git commit -m "journal update on ${HOSTNAME} @ ${DATE}"
git pull origin $BRANCH --no-edit
git push origin $BRANCH
I vary the minutes per host so that they don't attempt to push at once.
4,19,34,49 * * * * /home/chris/bin/journal-git.sh 2>&1 | logger -t journal