我有一个找不到的别名。输入 git help subaddvim
给我:
`git subaddvim' is aliased to `log HEAD'
我想我是这样定义的:
git config --local alias.subaddvim 'log HEAD'
我查看了 $repo_path/.gitconfig
、~/.gitconfig
、/etc/gitconfig
,但它们都没有 subaddvim条目。
我还能在哪里看?
最佳答案
Scott Chacon 的 excellent book "Pro Git"涵盖存储内容的位置,以及传递给 git config
以读取/写入该位置的选项:
Git comes with a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and operates. These variables can be stored in three different places:
/etc/gitconfig file: Contains values for every user on the system and all their repositories. If you pass the option --system to git config, it reads and writes from this file specifically.
~/.gitconfig file: Specific to your user. You can make Git read and write to this file specifically by passing the --global option.
config file in the git directory (that is, .git/config) of whatever repository you’re currently using: Specific to that single repository. Each level overrides values in the previous level, so values in .git/config trump those in /etc/gitconfig.
你可以让 git 告诉你使用 --list
选项定义了什么:
# shows all settings
git config --list
# shows system settings
git config --list --system
# shows user settings
git config --list --global
# shows project settings
git config --list --local
关于git - 我的 git 别名存储在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11747691/