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.
|
2017-06-15 23:30:21 +01:00
|
|
|
> These configurations can be local (for the current repository) or global (for the current user).
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://git-scm.com/docs/git-config>.
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2017-06-15 23:30:21 +01: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`
|
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
- List only global configuration entries (stored in `~/.gitconfig`):
|
2015-12-17 10:09:03 +00:00
|
|
|
|
|
|
|
`git config --list --global`
|
|
|
|
|
2022-08-16 03:04:51 +01:00
|
|
|
- List only system configuration entries (stored in `/etc/gitconfig`), and show their file location:
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2022-08-16 03:04:51 +01:00
|
|
|
`git config --list --system --show-origin`
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
- Get the value of a given configuration entry:
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
`git config alias.unstage`
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
- Set the global value of a given configuration entry:
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
`git config --global alias.unstage "reset HEAD --"`
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
- Revert a global configuration entry to its default value:
|
2015-12-17 10:09:03 +00:00
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
`git config --global --unset alias.unstage`
|
2020-07-17 18:40:48 +01:00
|
|
|
|
2021-01-07 14:06:38 +00:00
|
|
|
- Edit the Git configuration for the current repository in the default editor:
|
2020-07-17 18:40:48 +01:00
|
|
|
|
|
|
|
`git config --edit`
|
|
|
|
|
2021-01-07 14:06:38 +00:00
|
|
|
- Edit the global Git configuration in the default editor:
|
2020-07-17 18:40:48 +01:00
|
|
|
|
|
|
|
`git config --global --edit`
|