Software Development
Git configuration options you can’t miss
Whenever I start using a new machine for development these are the first options I setup.
First things first – Your name
1 2 | git config --global user.name "Andrea Salvadore" git config --global user.email "me@here.com" |
Better log messages
1 2 3 4 5 | git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
This command will generate nicely coloured and formatted git logs. See more details in here
Some common aliases
1 2 | git config --global alias.st status git config --global alias.ck=checkout |
merge tool
I use diffmerge or meld. The following configuration is for diffmerge
1 2 3 4 | git config --global merge.tool diffmerge git config --global mergetool.diffmerge.trustexitcode true git config --global mergetool.keepbackup false git config --global mergetool.diffmerge.cmd "/usr/bin/diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"" |
diff tool
1 2 | git config --global diff.tool diffmerge git config --global difftool.diffmerge.cmd diffmerge '$LOCAL' '$REMOTE' |
push current folder
1 | git config --global push. default current |
This will allow you to type
1 | git push origin |
instead of
1 | git push origin <current_branch_name> |
Tell git to ignore file permission changes
1 | git config --global core.filemode false |
Reference: Git configuration options you can’t miss from our JCG partner Andrea Salvadore at the Development in progress blog.