Read Anthropic’s case study about Graphite Reviewer

Unsetting git configuration settings

Greg Foster
Greg Foster
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Git configurations are stored in three main levels:

  1. System level: Applies settings universally to every user on the system and all their repositories.
  2. Global level: Applies settings to a user’s profile and all the repositories they interact with.
  3. Local level: Applies settings to a specific repository.

The configurations can include user credentials, preferred text editors, diff tools, and other settings that control Git's behavior.

Before unsetting a configuration, you might want to view the current settings. You can see all configurations or a specific configuration using the following commands:

Terminal
git config --list --show-origin # Shows all configurations with their origins
git config --global --list # Shows global configurations
git config --local --list # Shows configurations for the current repository

To remove a specific configuration entry, use the git config --unset command followed by the key of the configuration. For example, to unset the user name in the global config, run:

Terminal
git config --global --unset user.name

This command removes the user.name setting from the global configuration.

To remove a global configuration variable, you would use the same approach but specify the global option:

Terminal
git config --global --unset <key>

Replace <key> with the name of the configuration key you want to remove. For example, to delete a global email configuration:

Terminal
git config --global --unset user.email

Similarly, if you want to delete a configuration that is set at the local repository level:

Terminal
git config --local --unset <key>

For instance, to remove a local repository's specific configuration for a diff tool:

Terminal
git config --local --unset diff.tool

If you need to reset your Git configurations to their default settings, you should remove the configuration file. Git will recreate these files with default settings the next time it needs them.

To reset all global configurations, you can delete the global configuration file:

Terminal
rm ~/.gitconfig

This command deletes the global Git configuration file, effectively resetting all global configurations to their defaults.

For local repository configurations, you can remove the config file in the .git directory:

Terminal
rm .git/config

This action resets all configurations specific to the current repository.

For further reading on the Git configuration, see the official git documentation.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2