更新时间:2023-01-18 11:47:55
如果您知道新文件的位置(至少足以使用路径语法和通配符描述位置),则可以使用提交 Git挂钩.
If you know where the new files are located (at least enough to use path syntax and wildcards to describe the location) then you can accomplish this with a pre-commit Git hook.
例如,如果您的项目的.db_migrations
文件夹,您可以通过放置
For example, if you have Flask-Migrate database migrations in your project's .db_migrations
folder you can ensure that they are all added before your commits by placing
git add .db_migrations/versions/*.py
在项目的/.git/hooks/pre-commit
文件中.