diff options
-rwxr-xr-x | commit | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -127,7 +127,14 @@ function git_user { function git_commit { # Remove '--config' from args, otherwise it goes to the commit log params="`echo $* | sed -e 's/--config//'`" - git commit -a -m "$params" + + # If there are no staged files, commit everything. + # Otherwise commit just what was staged + if git status --short | grep -q "^[AM]"; then + flag="-a" + fi + + git commit $flag -m "$params" } # Main |