Re: Please default to 'commit -a' when no changes were added
- From
Adam Brewster <adambrewster@gmail.com>
- Date
- Apr 22, 2010, 21:48 UTC
- Message-ID
- <x2qc376da901004221448i373a342p1d7b763383e80472@mail.gmail.com>
- In-Reply-To
- <87sk6n4426.fsf@frosties.localdomain>
Show 15 quoted lines
>> What _you_ can do though, is this: >> >> git config --global alias.ci "commit -a" > > But then when I accidentally use 'git ci' while having an index the > index gets ignored and all changed files get commited in one big mess. > Given how seldom I need an index (so far never) the risk of using 'git > ci' accidentally is way to high. Same with typing -a. I do it so often > that when I actualy don't want it I will probably type it anyway out of > habbit. > > My way would be safe in that it will never ignore an index if there is > one. And if it is a new option then it would not alter the existing > semantic, just add to it. Call the option --smart-a or --a-if-empty. >
Consider
$ echo -e '#!/bin/bash\nif git diff-tree --quiet HEAD; then git commit -a; else git commit; fi' > `git --exec-path`/git-ci $ chmod 555 `git --exec-path`/git-ci
Adam