1

我正在尝试将isort,添加blackflake8我的项目的pre-commit挂钩中,当我编辑一个文件时它可以正常工作。

我想要实现isort的是项目的一个目录isort -rc .并将更改推送到远程存储库,但它给了我Everything up-to-date,但是当我检查git status它时,它会显示所有修改。

有人可以帮助弄清楚我做错了什么吗?下面我发布屏幕截图和代码片段。谢谢!

在此处输入图像描述 •100% ➜ git status 在分支 2020-01-29-test-pre-commit 你的分支是最新的'origin/2020-01-29-test-pre-commit'。

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   athlete_report/algorithm/yazs/cc_calculation_copy.py
    modified:   athlete_report/algorithm/yazs/dto/session_event.py
    modified:   athlete_report/algorithm/yazs/formula/flow_processor.py
    modified:   athlete_report/algorithm/yazs/input/flow_input_processor.py
    modified:   athlete_report/algorithm/yazs/input/single_source_handler.py
    modified:   athlete_report/algorithm/yazs/input/two_sources_handler.py
    modified:   athlete_report/algorithm/yazs/vertical_jump/vert_jump.py
    modified:   athlete_report/algorithm/yazs/yazs_calculation.py
    modified:   athlete_report/pdf_generator/athlete_report_builder.py

(mbp37)
src on  2020-01-29-test-pre-commit [+] via  mbp37
•100% ➜ git add .
(mbp37)
src on  2020-01-29-test-pre-commit [+] via  mbp37
•100% ➜ git commit -am "add modifications to athlete report"
seed isort known_third_party.............................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /Users/hzhang/Work/yana-motion-lab/report-engine/src/athlete_report/pdf_generator/athlete_report_builder.py

black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted /Users/hzhang/Work/yana-motion-lab/report-engine/src/athlete_report/pdf_generator/athlete_report_builder.py
All done! ✨  ✨
1 file reformatted, 8 files left unchanged.

Flake8...................................................................Passed
(mbp37)
src on  2020-01-29-test-pre-commit [+] via  mbp37 took 3s
•100% ➜ git diff
(mbp37)
src on  2020-01-29-test-pre-commit [+] via  mbp37
•100% ➜ git push
Everything up-to-date
(mbp37)
src on  2020-01-29-test-pre-commit [+] via  mbp37 took 2s
•100% ➜ git diff
4

1 回答 1

1

因为提交所做的更改pre-commit被取消(因为提交的内容不正确)

您需要查看所做的更改(git status/ git diff),如果工具所做的自动更改看起来正确,您将git add -u重新运行您的git commit命令(^R+git commit在这里可能会有所帮助)

没有要推送的提交,因为提交已取消

于 2020-01-30T17:20:24.480 回答