Re: Please default to 'commit -a' when no changes were added

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adam Brewster <adambrewster@xxxxxxxxx> writes:

>>> 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

% if git diff-tree --quiet HEAD; then git commit -a; else git commit; fi
7a15ef233c9ea900c9176f4a09260bb64a7e40cb
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   debian/changelog
#       modified:   debian/control
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       debian/files
no changes added to commit (use "git add" and/or "git commit -a")


That does not do the right thing but I was thinking along the same lines
for a personal fix.

MfG
        Goswin
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]