【发布时间】:2019-06-01 01:46:18
【问题描述】:
运行 MacOs High Sierra 10.13.4 和 git 版本 2.17.0。
这是我的工作流程:
git rm ./some/file.out- 运行
git status看到./some/file.out的删除正在等待提交 - 检查
ls ./some/并查看文件已被删除 - 运行
git commit并查看消息,其中一个文件已被删除
但是:
- 如果我随后运行
git status,我会看到文件仍然存在但未跟踪。 - 在未跟踪的文件上运行
git clean -df时,它会被删除并且不会返回。
我也试过
- 用非git删除文件
rm ./some/file.out - 运行
git add .然后git commit并查看文件已删除消息 - 运行
git status并显示文件仍然存在,但未跟踪
这似乎是最近才开始发生的。
这是我的 git 配置:
credential.helper=osxkeychain
core.hookspath=/Users/myname/.git_hooks
core.excludesfile=/Users/myname/.gitignore
user.email=myname@somewhere.com
color.ui=true
color.branch=true
color.status=true
color.diff=true
color.interactive=true
color.grep=true
color.pager=true
color.decorate=true
color.showbranch=true
alias.pt=!git push -u origin `git rev-parse --abbrev-ref HEAD`
alias.co=checkout
alias.cob=checkout -B
alias.b=branch
alias.bd=branch -D
可能会发生什么——具体来说,有没有其他人看到过这样的事情并发现它与 git 相关?
只是在终端中删除文件(非git repo文件)没有这种行为。
【问题讨论】:
-
您确定该文件不是由其他程序自动生成的吗?
-
我确保我的 IDE 没有运行(以防万一导致了 futz),但没有任何东西应该引用我所在的目录。为了测试这是否发生在我的用户家之外,我在我的
/tmp中创建了一个目录,并在该文件夹中初始化了一个 repo。添加了一些文件并观察到相同的功能。我所知道的不应该引用我手动添加到/tmp的新目录。此外,我见过这种情况的唯一一次是通过 git。使用rm foo.out的文件的正常删除只是保持删除状态。
标签: git macos macos-high-sierra