diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-05-14 14:21:11 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-05-14 14:21:11 -0300 |
commit | fc6d705e67aaf7489c3465d7cab85dd57b81b0f7 (patch) | |
tree | cda1b689d497e96c4b241c4b30bfd714045f8cd6 | |
parent | 7da22e17ba471e1de20c394db8bfd84be32c8975 (diff) | |
download | utils-git-fc6d705e67aaf7489c3465d7cab85dd57b81b0f7.tar.gz utils-git-fc6d705e67aaf7489c3465d7cab85dd57b81b0f7.tar.bz2 |
Check for staged files at commit script
-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 |