Home » Software Development » Git configuration options you can’t miss

About Andrea Salvadore

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

git config --global user.name "Andrea Salvadore"
git config --global user.email "me@here.com"

Better log messages

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

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

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

git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd diffmerge '$LOCAL' '$REMOTE'

push current folder

git config --global push.default current

This will allow you to type

git push origin

instead of

git push origin <current_branch_name>

Tell git to ignore file permission changes

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.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

and many more ....

Leave a Reply

Your email address will not be published. Required fields are marked *

*


three × 6 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close