Skip to content

Instantly share code, notes, and snippets.

@Mtillmann
Created February 5, 2024 12:34
Show Gist options
  • Save Mtillmann/c25c17f4edb3ee3408e440ad4a25e94c to your computer and use it in GitHub Desktop.
Save Mtillmann/c25c17f4edb3ee3408e440ad4a25e94c to your computer and use it in GitHub Desktop.
automatically push homes(h)ick castles when they have changes
#!/usr/bin/bash
# crontab -e
# * */2 * * * /home/martin/push-homesick-castles.sh dotfiles > /dev/null 2>&1
if [ $# -eq 0 ]
then
echo "Usage $0 castle1[, castle2, castle3, ...]"
exit 1
fi
for castle in "$@"
do
cd "$HOME/.homesick/repos/$castle"
if [ -n "$(git status --porcelain)" ]
then
git add .
git commit -am "commited by push-homesick-castles.sh at $(date)"
git push
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment