From e1f5d68995052442300b93ae0c6b85c3dea75255 Mon Sep 17 00:00:00 2001 From: lucasmerlin Date: Tue, 4 Mar 2025 11:38:46 +0100 Subject: [PATCH] Improved git lfs instructions (#5707) * Closes * [x] I have followed the instructions in the PR template --- CONTRIBUTING.md | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 48c9e9ae..e0596121 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,13 +35,7 @@ You can test your code locally by running `./scripts/check.sh`. There are snapshots test that might need to be updated. Run the tests with `UPDATE_SNAPSHOTS=true cargo test --workspace --all-features` to update all of them. For more info about the tests see [egui_kittest](./crates/egui_kittest/README.md). - -We use [git-lfs](https://git-lfs.com/) to store big files in the repository. -Make sure you have it installed (running `git lfs ls-files` from the repository root should list some files). -Don't forget to run `git lfs install` after installing the git-lfs binary. -You need to add any .png images to `git lfs`. -If the CI complains about this, make sure you run `git add --renormalize .`. - +Snapshots and other big files are stored with git lfs. See [Working with lfs](#working-with-lfs) for more info. If you see an `InvalidSignature` error when running snapshot tests, it's probably a problem related to git-lfs. When you have something that works, open a draft PR. You may get some helpful feedback early! @@ -51,6 +45,31 @@ Don't worry about having many small commits in the PR - they will be squashed to Please keep pull requests small and focused. The smaller it is, the more likely it is to get merged. +## Working with git lfs + +We use [git-lfs](https://git-lfs.com/) to store big files in the repository. +Make sure you have it installed (running `git lfs ls-files` from the repository root should list some files). +Don't forget to run `git lfs install` in this repo after installing the git-lfs binary. +You need to add any .png images to `git lfs` (see the .gitattributes file for rules and exclusions). +If the CI complains about lfs, try running `git add --renormalize .`. + +Common git-lfs commands: +```bash +# Install git-lfs in the repo (installs git hooks) +git lfs install + +# Move a file to git lfs +git lfs track "path/to/file/or/pattern" # OR manually edit .gitattributes +git add --renormalize . # Moves already added files to lfs (according to .gitattributes) + +# Move a file from lfs to regular git +git lfs untrack "path/to/file/or/pattern" # OR manually edit .gitattributes +git add --renormalize . # Moves already added files to regular git (according to .gitattributes) + +# Push to a contributor remote (see https://github.com/cli/cli/discussions/8794#discussioncomment-8695076) +git push --no-verify +``` + ## PR review Most PR reviews are done by me, Emil, but I very much appreciate any help I can get reviewing PRs!