aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcommit9
1 files changed, 8 insertions, 1 deletions
diff --git a/commit b/commit
index c5d3f4a..ccf03f6 100755
--- a/commit
+++ b/commit
@@ -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