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 two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


+ 9 = fifteen



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

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

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close