【发布时间】:2020-11-21 16:53:09
【问题描述】:
当我输入git status 时,我得到下面的输出。
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: services/replication/jobs/go.mod
new file: services/replication/jobs/go.sum
modified: services/replication/jobs/job.go
Changes not staged for commit:
....
Untracked files:
(use "git add <file>..." to include in what will be committed)
.circleci/pagerduty.sh
common/nodejs/universal-search/src/utils/aspect_ratio.spec.ts
common/nodejs/universal-search/src/utils/aspect_ratio.ts
common/nodejs/universal-search/src/utils/index.ts
infra/universal_search_apple/pulumi/resources/route53/
然后我用git commit -m 'Test commit.' 提交,不知何故,未跟踪的文件出现在提交中。
husky > pre-commit (node v14.5.0)
???? Finding changed files since git revision b495d278.
???? Found 0 changed files.
✅ Everything is awesome!
No staged files match any of provided globs.
[gps-289 b613c603] Test commit.
15 files changed, 248 insertions(+), 454 deletions(-)
create mode 100644 common/nodejs/universal-search/src/utils/aspect_ratio.spec.ts
create mode 100644 common/nodejs/universal-search/src/utils/aspect_ratio.ts
create mode 100644 common/nodejs/universal-search/src/utils/index.ts
delete mode 100644 external/ambient.d.ts
delete mode 100644 infra/metadata/Pulumi.dev.yaml
delete mode 100644 infra/metadata/Pulumi.prod.yaml
...
即使Changes to be committed?下只有3个文件,为什么提交中仍显示未跟踪的文件
【问题讨论】:
-
你在比较苹果和橘子。
-
您能详细说明一下吗?
-
首先你和 git 对话,然后你和 husky 对话。您正在与两个不同的人谈论两种不同的事情。找出您使用 git “提交”中的文件的方法是询问 git。