Git - Get your configuration right

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'
    
  • Fetch Global Configuration
    git config --global --get user.email
    git config --global --get user.name
    
  • Set Local Configuration
    git config user.email abc@org.com
    git config user.name 'User Name'
    
  • Fetch Local Configuration
    git config --get user.email
    git config --get user.name