Setting git default flags on commands

git, logging

Solution

Since git version 1.7.6, git config has gained a log.abbrevCommit option which can be set to true. Thus the answer is upgrade to at least 1.7.6 (current as of this writing is 1.7.11.4) and use:

git config --global log.abbrevCommit true

Problem

I want to know if there is a way to set a flag by default for git command. Specifically, I want to set the `--abbrev-commit` flag so that when executing `git log`, I want to execute `git log --abbrev-commit`. Unlike the question "is there any way to set a flag by default for a git command?", there is apparently not a configuration flag for adding --abbrev-commit to git log. Furthermore, the git manual states that I cannot create an alias: "To avoid confusion and troubles with script usage, aliases that hide existing git commands are ignored" My third option is to invent a new alias like `glog=log --abbrev-commit` in my .gitconfig file. But I'd rather not invent my own DSL with new commands. Is there another way to achieve it so that the `abbrev-commit` flag is set by default??

Original source

Related problems