不同级别的 .gitignore 如何工作?
How do .gitignore on different levels work?
我在 ~/.gitignore
中有一行(特定于 vim 的规则):
[._]*.s[a-w][a-z]
和应用程序的本地 .gitignore
。
git status -u
打印以下内容:
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore.swp
而且我确实没有将 .gitignore.swp
添加到跟踪文件中,因为我不想这样做!
如果我将 [._]*.s[a-w][a-z]
行添加到本地(项目)文件夹,则 git status -u
输出:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
这是预期的(我跟踪我的 .gitignore
),但请注意临时 vim 文件被忽略,因为 la
仍然打印它。
由于我与其他人合作处理许多项目,因此我不想拖拽特定于我的工作流程的规则。
我能否将 .gitignore
放在一个会影响所有项目的地方 我的用户 正在处理?
设为~/.config/git/ignore
我在 ~/.gitignore
中有一行(特定于 vim 的规则):
[._]*.s[a-w][a-z]
和应用程序的本地 .gitignore
。
git status -u
打印以下内容:
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore.swp
而且我确实没有将 .gitignore.swp
添加到跟踪文件中,因为我不想这样做!
如果我将 [._]*.s[a-w][a-z]
行添加到本地(项目)文件夹,则 git status -u
输出:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
这是预期的(我跟踪我的 .gitignore
),但请注意临时 vim 文件被忽略,因为 la
仍然打印它。
由于我与其他人合作处理许多项目,因此我不想拖拽特定于我的工作流程的规则。
我能否将 .gitignore
放在一个会影响所有项目的地方 我的用户 正在处理?
设为~/.config/git/ignore