2015-12-17 10:09:03 +00:00
|
|
|
# git config
|
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
> Manage custom configuration options for git repositories.
|
|
|
|
> 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`
|
|
|
|
|
2017-06-15 23:30:21 +01:00
|
|
|
- List all configuration entries that have been defined either locally or globally:
|
2015-12-17 10:09:03 +00:00
|
|
|
|
|
|
|
`git config --list`
|
|
|
|
|
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
|
|
|
|
|
|
|
- Edit the git configuration for the current repository in the default editor:
|
|
|
|
|
|
|
|
`git config --edit`
|
|
|
|
|
|
|
|
- Edit the global git configuration in the default editor:
|
|
|
|
|
|
|
|
`git config --global --edit`
|