X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=auto-commit-changes;fp=auto-commit-changes;h=d46dd555d2c896a319c0ac4b96d5fe7ccef75ed2;hb=523b7ff889aaafdcd997d84b2a06744993018e89;hp=0000000000000000000000000000000000000000;hpb=2ff8740f1061a31683152a4447340921de82b1b9;p=distro-setup diff --git a/auto-commit-changes b/auto-commit-changes new file mode 100755 index 0000000..d46dd55 --- /dev/null +++ b/auto-commit-changes @@ -0,0 +1,19 @@ +#!/bin/bash + +commit() { + if ! git diff --quiet || ! git diff --cached --quiet; then + # even with -q, it emits a newline into stderr + git commit -qam autocommit 2>/dev/null + fi +} + + + +if [[ $1 ]]; then + for dir; do + cd $dir + commit + done +else + commit +fi