Setting git default flags on commands Setting git default flags on commands git git

Setting git default flags on commands


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


You can use a custom format to have git log mimic --abbrev-commit by default:

git config format.pretty "format:%h %s"


There is no generic mechanism in git to set default arguments for commands.

You can use git aliases to define a new command with the required arguments:

git config alias.lg "log --oneline"

Then you can run git lg.

Some commands also have configuration settings to change their behavior.