【发布时间】:2021-07-04 21:41:50
【问题描述】:
我有一个devlog 文件夹,我在其中写下我希望通过git status 显示的想法/示例代码。排除这些文件后,我通常只能git add .; git commit,但显然devlog 中的内容禁止这样做。我喜欢有一个 git 钩子,它可以在提交之前取消整个路径及其内容。
我试过了:
git rm --cached devlog/*
但显然,它希望./devlog 的所有内容都已经上演(包括那些被.gitignore 忽略的内容),因此会引发错误:
git rm --cached devlog/*
#> fatal: pathspec 'devlog/check.log' did not match any files
其中devlog/check.log 被忽略并且根本没有上演。
【问题讨论】:
标签: git hook pre-commit-hook unstage