gpt4 book ai didi

python - Pycharm、django南迁文件与git整合

转载 作者:太空宇宙 更新时间:2023-11-04 06:01:52 24 4
gpt4 key购买 nike

如你所知,django南迁移文件是通过下面的命令生成的;

# python manage.py schemamigration model_name --auto

有时,我忘记将迁移文件添加到项目存储库中。

在将其他项目文件提交到存储库之前,有没有办法在pycharm中显示手动生成的迁移文件的提醒以添加git repo?

最佳答案

根据 pancakes 的评论,我启用了 pre-commit 钩子(Hook)并在下面附加了几行:

ud=`git status -u | grep '^Untracked files:$'`

if [ -n "$ud" ];
then
cat <<\EOF
Warning: There are new files exists and not added to project repo.
EOF
exit 1
fi

现在,git 在新文件可用时发出警告,并在提交前中断进程。这也适用于带有错误 pop 窗口的 PyCharm。

关于python - Pycharm、django南迁文件与git整合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24454072/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com