手动导入python目录,然后无法推送到远程存储库

2024-09-30 16:29:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试将isortblackflake8添加到我的项目的pre-commit挂钩中,当我编辑一个文件时,效果很好

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

有人能帮我找出我做错了什么吗?下面我发布了截图和代码片段。谢谢

enter image description here •100% ➜ git状态 关于分支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

Tags: topytestgitreportsrconpre
1条回答
网友
1楼 · 发布于 2024-09-30 16:29:34

因为更改是由pre-commit进行的,所以提交被取消(因为提交的内容不正确)

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

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

相关问题 更多 >