【发布时间】:2020-05-25 10:26:29
【问题描述】:
情况
在 Ubuntu 16.04 LTS 中使用 gedit 3.18.3。
我的 .git/info/exclude 文件是
# git ls-files --others --exclude-from=.git/info/exclude
# 以 '#' 开头的行是 cmets。 # 对于一个主要使用 C 语言的项目,以下将是一组很好的
# 排除模式(如果你想使用它们,请取消注释):
# 文件
*.[oa]
*~
*.log
生成文件*
所以我希望匹配*~ 模式的文件会被忽略。
问题
但是,这些都保留在计数中
git status
On branch v2
Your branch is up-to-date with 'origin/v2'.
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: README.md
modified: README.md~
no changes added to commit (use "git add" and/or "git commit -a")
此行为由
确认git ls-files --cached --ignored --exclude-standard
如Git: List files that should be ignored, but are not建议的那样
问题
我不希望 README.md~ 或任何其他 *~ 文件出现在列表中。
这曾经像微风一样工作,但我无法确定出错的时刻。
请问有什么提示和解决方法吗?
【问题讨论】:
-
stackoverflow.com/a/1274447/7976758 — 答案是关于
.gitignore,但对于任何 git 排除机制都是正确的 — 全局.gitignore或.git/info/exclude。