Skip to content

Add Cargo.lock to .gitignore#60

Closed
aymannel wants to merge 1 commit into
mainfrom
update-gitignore
Closed

Add Cargo.lock to .gitignore#60
aymannel wants to merge 1 commit into
mainfrom
update-gitignore

Conversation

@aymannel

@aymannel aymannel commented Sep 9, 2025

Copy link
Copy Markdown
Collaborator

This PR adds Cargo.lock to the .gitignore file.

For libraries and shared crates, Cargo.lock should not be committed. Cargo will automatically resolve and generate a lockfile for consumers of the library, ensuring they can update dependencies according to their own environments and requirements.

Keeping it out of version control avoids unnecessary merge conflicts and noisy diffs caused by dependency updates that are not directly relevant to the library code.

@Ectras

Ectras commented Sep 9, 2025

Copy link
Copy Markdown
Collaborator

It used to be added to the .gitignore for libraries by default, but this is no longer the case. In essence, it's a trade-off (see here):

Advantage: Determinism / Reproducibility, especially for CI
Disadvantage: Tricky merge conflicts. When I encounter those, I usually merge the Cargo.toml and regenerate the Cargo.lock, but this can update other dependencies as well

@aymannel aymannel closed this Sep 22, 2025
@Ectras Ectras deleted the update-gitignore branch September 22, 2025 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants