diff options
| author | Anton Bobov <anton@bobov.name> | 2026-07-31 23:18:15 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2026-07-31 23:18:29 +0500 |
| commit | 1793b1a814ed1446a65d8ef97dd9c382bb3b795f (patch) | |
| tree | 3057b84ae84b379a7848aaf29a96e5182fd2f7b6 /git-auto-commit | |
| parent | 30a4de178ff2a3cb481dfefd4b51ea0f8eea416f (diff) | |
add git-auto-commit
Diffstat (limited to 'git-auto-commit')
| -rwxr-xr-x | git-auto-commit | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/git-auto-commit b/git-auto-commit new file mode 100755 index 0000000..72f13a4 --- /dev/null +++ b/git-auto-commit @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# This script automates Git staging and committing for a specified directory. + +set -euo pipefail + +main() { + local git_dir="${1:-}" + git -C "$git_dir" add --all + git -C "$git_dir" diff-index --quiet HEAD -- || + git -C "$git_dir" commit --quiet --message "Auto-commit: $(date '+%Y-%m-%d %H:%M:%S')" +} + +main "$@" |
