git - 我的 git 别名存储在哪里?

标签 git alias

我有一个找不到的别名。输入 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/

相关文章:

linux - 尝试使用 tailf -f 打印 json 部分的日志文件并保留标题未转换

regex - Git - 不包括{}的颜色词

git - 你如何在 Git 提交中搜索制表符?

git - TortoiseGit 与 Git 扩展

MySQL 查询 - 未知列

MySQL : IS NOT NULL check on custom generated column(alias)

git 将分支推送到具有不同名称的新仓库

Git:推送到远程存储库时更新网站?

bash - 如何在 shell 脚本中创建别名?

scala 类型标签和类型别名