diff --git a/git-helper b/git-helper old mode 100644 new mode 100755 index 1a9efad..02022da --- a/git-helper +++ b/git-helper @@ -1,13 +1,18 @@ -#!/bin/bash +#!/usr/bin/env bash +# git-commit-safe - Add all and commit with a message (no push) +set -euo pipefail -cd ~/Desktop/calender || exit +msg="${1:-}" +if [[ -z "$msg" ]]; then + echo "Usage: $0 \"commit message\"" + exit 2 +fi -git add . +git add -A +if git diff --cached --quiet; then + echo "No staged changes to commit." + exit 0 +fi -read -p "commit msg: " COMMITMSG - -git commit -m "$COMMITMSG" - -git push - -cd ~ +git commit -m "$msg" +echo "Committed with message: $msg" \ No newline at end of file