Created
May 8, 2017 14:22
-
-
Save Arood/2e00b732647cee657ed68abe45860334 to your computer and use it in GitHub Desktop.
git status/add/commit in one command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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