Git 在 MacOS 上执行 git rm 后提交后恢复文件

Git on MacOS restoring file after commit when doing a git rm

运行宁 MacOs High Sierra 10.13.4 和 git 版本 2.17.0.

这是我的工作流程:

但是:

我也试过了

这似乎是最近才开始发生的。

这是我的 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 文件)没有这种行为。

查看我的 ~/.git_hooks。看起来我的 ~/.git_hooks/pre-commit.d 文件夹中调用的脚本是罪魁祸首。

不确定脚本到底在做什么(或应该做什么),但是当我删除脚本时,git rm && git commit 功能按预期工作——不再有文件起死回生!