Skip to content

Instantly share code, notes, and snippets.

@derekgreer
Last active August 29, 2015 14:04
Show Gist options
  • Save derekgreer/739d7f58b23a026ad532 to your computer and use it in GitHub Desktop.
Save derekgreer/739d7f58b23a026ad532 to your computer and use it in GitHub Desktop.
git-commit-often.bash
#!/bin/bash
while (( 1 ))
do
BRANCH=$(git rev-parse --abbrev-ref HEAD)
CHANGES=$(git status --porcelain)
if [[ "${CHANGES}" != "" && "${BRANCH}" != "master" ]]
then
echo "There are changes or untracked files to be committed."
DATE=$(date +%Y%m%d-%s)
git add --all .
git commit -m "${DATE}:squash me!"
fi
sleep $(( 60 * 5 ))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment