From: Adam Brewster Date: Fri, 23 Apr 2010 00:04:20 GMT Subject: Re: Please default to 'commit -a' when no changes were added Message-ID: In-Reply-To: > > Perhaps I am missing something, but I would have thought git > diff-files --quiet would be more useful in this context... > > jon. > Maybe so. I really just meant to suggest that if you need something more complicated than a simple git-command, you can put whatever you want in a shell script and use it like an alias. Then I learned that git aliases can be pretty fancy if they start with "!sh -c". After looking at the man pages a bit more, I think "git diff --cached --quiet" or "git diff-index --cached --quiet HEAD" are the right condition. git diff-files will compare the working copy to the index, so this sequence vi file1 vi file2 git add file1 git ci would call commit -a, and I think that's wrong. I also now realize that some use needs to be made of the arguments. As I sent it the first time, "git ci -m whatever" doesn't work as it should. Adding "$@" to the git commit call doesn't work either because it breaks "git ci filename" if there is no index (it calls "git commit -a filename").