Should I commit .lock file changes separately? What should I write for the commit message?

假装没事ソ 提交于 2021-02-07 14:29:40

问题


I'm using poetry for my Python package manager but I believe this would apply to any programming practices.

I've been doing this without knowing exactly what I'm doing, or how I should be doing.

When you use a package manager and install a new package, there's usually a .lock file change to keep your build deterministic.

Usually, I would commit these changes like:

$ git add poetry.lock pyproject.toml 
$ git commit -m "Install packages: beautifulsoup4"

i.e, I make a commit every time I install/remove a package. I do it because I FEEL like this is what I should do, but I have 0 clue if this is actually a correct way to handle this.

Am I doing great? or is there any other specific convention & rules I should abide by to make it follow the best practices as close as possible?


回答1:


During development, it isn't necessary to commit lockfiles and share a single one between team members. The pyproject.toml file is the reference for correct build instructions, and the lockfile is the reference for a single working platform specific deployment.

It is not unusual for projects to keep updating a single lockfile since it cuts down on build time, but I wouldn't consider it a best practice. Arguably, adding poetry.lock to the .gitignore is a better practice than what you do, and only commit pyproject.toml changes when you add dependencies.



来源:https://stackoverflow.com/questions/61037557/should-i-commit-lock-file-changes-separately-what-should-i-write-for-the-commi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!