Global settings are written in ~/.gitconfig
$ git config --global user.email "Your email"
$ git config --global user.name "Your name"
$ git config --global color.ui auto
Note: color.ui is a set of 'color.branch, color.diff, color.interactive, color.status'
You can set different colors for each color.*
or use diff-highlight (I like this rather than color.ui)
Default packages of git include diff-highlight(https://github.com/git/git/tree/master/contrib/diff-highlight)
If you would like to always merge with non fast-forward (default is fast-forward)
$ git config --global merge.ff false
and if you would like to work with fast-forward when using pull (default is fast-forward)
$ git config --global alias.${name u like} 'pull --ff-only'
or
$ git config --global pull.rebase true
if you use Git2.x
$ git config --global pull.ff only
I like this configs :)
$ git config --global alias.stp 'stash'
$ git config --global alias.stq 'stash pop'
$ git config --global alias.stt 'status'
Note: 'status' and 'stash *' are starting with 'sta'
When I want to use 'git status', I often type 'git sta'
In this case, the completion system often suggest 'git stash' to me and then I cannot stop typing enter-key :(
$ git config --global alias.cl 'log'
$ git config --global alias.rl 'reflog'
I hate to spend long time with typing :(
Local settings are written in .git/config
$ cd /path/to/local/gitrepo/
you type the commands (which I wrote) which is removed --global
In my environment(git 1.8.5.2 Mac OS X 9.3), "git config --global alias.pull 'pull --ff-only'" doesn't work.
Even after configured it, "git pull" works just as "git pull" and may make merge commit when non-fast-forward.
I could configure with the command below.
$ git config --global alias.p 'pull --ff-only
$ git p
fatal: Not possible to fast-forward, aborting.
$
It seems that we cannot overwrite "git pull" and should use other expression.