DEV Community

Manish R Warang
Manish R Warang

Posted on • Originally published at blog.g33kzone.com on

Git - Get your configuration right

Many of our fellow developers might use the same old laptop for work as well as personal projects. In such cases, one might want the flexibility of quickly switching git configuration as per the type of project working upon.

For such scenarios, it would be advisable to leverage Git's global & local (i.e. limited to the project) configuration changes.

  • Set Global Configuration
git config user.email abc@org.com
git config user.name 'User Name'

Enter fullscreen mode Exit fullscreen mode
  • Fetch Global Configuration
git config --global --get user.email
git config --global --get user.name

Enter fullscreen mode Exit fullscreen mode
  • Set Local Configuration
git config user.email abc@org.com
git config user.name 'User Name'

Enter fullscreen mode Exit fullscreen mode
  • Fetch Local Configuration
git config --get user.email
git config --get user.name

Enter fullscreen mode Exit fullscreen mode

Top comments (0)