Skip to content

Instantly share code, notes, and snippets.

@Arood
Created May 8, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arood/2e00b732647cee657ed68abe45860334 to your computer and use it in GitHub Desktop.
Save Arood/2e00b732647cee657ed68abe45860334 to your computer and use it in GitHub Desktop.
git status/add/commit in one command
#!/bin/bash
status=$(git -c color.status=always status -s)
if [ "$status" == "" ]; then
printf "Nothing to commit\n"
exit 1
fi
printf "%s\n\nEnter your commit message, or cancel with Ctrl+C:\n" "$status"
read message
if [ "$message" == "" ]; then
printf "You must enter a commit message\n"
exit 1
fi
git add .
git commit -m "$message"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment