Skip to content

Instantly share code, notes, and snippets.

@JamesSwift
Created August 3, 2012 11:32
Show Gist options
  • Save JamesSwift/3246823 to your computer and use it in GitHub Desktop.
Save JamesSwift/3246823 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Aug 3, 2012.
    9 changes: 9 additions & 0 deletions commit_if_changed.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/bin/bash
    cd /path/to/your/git/repo/
    if [ "$(git status -s)" ] ; then
    echo "Changes detected. Commiting."
    git add .
    git commit -am "Your explanation here"
    else
    echo "No changes detected. Commit canceled."
    fi