tldr/pages/common/git-config.md

38 lines
1.1 KiB
Markdown
Raw Normal View History

2015-12-17 10:09:03 +00:00
# git config
2021-01-07 14:06:38 +00:00
> Manage custom configuration options for Git repositories.
> These configurations can be local (for the current repository) or global (for the current user).
> More information: <https://git-scm.com/docs/git-config>.
2015-12-17 10:09:03 +00:00
- List only local configuration entries (stored in `.git/config` in the current repository):
2015-12-17 10:09:03 +00:00
`git config --list --local`
- List only global configuration entries (stored in `~/.gitconfig` by default or in `$XDG_CONFIG_HOME/git/config` if such a file exists):
2015-12-17 10:09:03 +00:00
`git config --list --global`
- List only system configuration entries (stored in `/etc/gitconfig`), and show their file location:
2015-12-17 10:09:03 +00:00
`git config --list --system --show-origin`
2015-12-17 10:09:03 +00:00
- Get the value of a given configuration entry:
2015-12-17 10:09:03 +00:00
`git config alias.unstage`
2015-12-17 10:09:03 +00:00
- Set the global value of a given configuration entry:
2015-12-17 10:09:03 +00:00
`git config --global alias.unstage "reset HEAD --"`
2015-12-17 10:09:03 +00:00
- Revert a global configuration entry to its default value:
2015-12-17 10:09:03 +00:00
`git config --global --unset alias.unstage`
2021-01-07 14:06:38 +00:00
- Edit the Git configuration for the current repository in the default editor:
`git config --edit`
2021-01-07 14:06:38 +00:00
- Edit the global Git configuration in the default editor:
`git config --global --edit`