aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-05-14 14:21:11 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-05-14 14:21:11 -0300
commitfc6d705e67aaf7489c3465d7cab85dd57b81b0f7 (patch)
treecda1b689d497e96c4b241c4b30bfd714045f8cd6
parent7da22e17ba471e1de20c394db8bfd84be32c8975 (diff)
downloadutils-git-fc6d705e67aaf7489c3465d7cab85dd57b81b0f7.tar.gz
utils-git-fc6d705e67aaf7489c3465d7cab85dd57b81b0f7.tar.bz2
Check for staged files at commit script
-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