Skip to content

Commit e1f5d68

Browse files
authored
Improved git lfs instructions (#5707)
* Closes <#5526> * [x] I have followed the instructions in the PR template
1 parent 26288d7 commit e1f5d68

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

CONTRIBUTING.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ You can test your code locally by running `./scripts/check.sh`.
3535
There are snapshots test that might need to be updated.
3636
Run the tests with `UPDATE_SNAPSHOTS=true cargo test --workspace --all-features` to update all of them.
3737
For more info about the tests see [egui_kittest](./crates/egui_kittest/README.md).
38-
39-
We use [git-lfs](https://git-lfs.com/) to store big files in the repository.
40-
Make sure you have it installed (running `git lfs ls-files` from the repository root should list some files).
41-
Don't forget to run `git lfs install` after installing the git-lfs binary.
42-
You need to add any .png images to `git lfs`.
43-
If the CI complains about this, make sure you run `git add --renormalize .`.
44-
38+
Snapshots and other big files are stored with git lfs. See [Working with lfs](#working-with-lfs) for more info.
4539
If you see an `InvalidSignature` error when running snapshot tests, it's probably a problem related to git-lfs.
4640

4741
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
5145

5246
Please keep pull requests small and focused. The smaller it is, the more likely it is to get merged.
5347

48+
## Working with git lfs
49+
50+
We use [git-lfs](https://git-lfs.com/) to store big files in the repository.
51+
Make sure you have it installed (running `git lfs ls-files` from the repository root should list some files).
52+
Don't forget to run `git lfs install` in this repo after installing the git-lfs binary.
53+
You need to add any .png images to `git lfs` (see the .gitattributes file for rules and exclusions).
54+
If the CI complains about lfs, try running `git add --renormalize .`.
55+
56+
Common git-lfs commands:
57+
```bash
58+
# Install git-lfs in the repo (installs git hooks)
59+
git lfs install
60+
61+
# Move a file to git lfs
62+
git lfs track "path/to/file/or/pattern" # OR manually edit .gitattributes
63+
git add --renormalize . # Moves already added files to lfs (according to .gitattributes)
64+
65+
# Move a file from lfs to regular git
66+
git lfs untrack "path/to/file/or/pattern" # OR manually edit .gitattributes
67+
git add --renormalize . # Moves already added files to regular git (according to .gitattributes)
68+
69+
# Push to a contributor remote (see https://github.com/cli/cli/discussions/8794#discussioncomment-8695076)
70+
git push --no-verify
71+
```
72+
5473
## PR review
5574

5675
Most PR reviews are done by me, Emil, but I very much appreciate any help I can get reviewing PRs!

0 commit comments

Comments
 (0)