Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
301 views
in Technique[技术] by (71.8m points)

In Dart and Pub, should I add pubspec.lock to my .gitignore?

Should I add this generated file to my .gitignore so that it doesn't show up in my repository?

Should pubspec.lock be included in my repository?

question from:https://stackoverflow.com/questions/16136739/in-dart-and-pub-should-i-add-pubspec-lock-to-my-gitignore

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This answer has two parts, similarly to the question and answer in this question about Ruby bundler.

Application packages

If you are working on an application package, then you should keep the pubspec.lock file in your repository as a snapshot of your dependencies.

From the Pub glossary:

Application packages should check their lockfiles into source control, so that everyone working on the application and every location the application is deployed has a consistent set of dependencies.

Library packages

However, if you are working on a library package, then you should not check in the lockfile.

From the Pub glossary:

Library packages should not check their lockfile into source control, since they should support a range of dependency versions.


See also the Pub glossary entry for lockfiles


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...