Spenhouet
Spenhouet

Reputation: 7169

Does `git lfs track` do more than writing to `.gitattributes`?

From my understanding .gitattributes works similar as .gitignore. If I define a filter in .gitattributes, this filter will take effect and the files will be transferred to LFS.

In every GIT LFS related document (official documentation, stackoverflow answers, ...) it is recommended to run git lfs track.

Does git lfs track do anything else than writing the filter to .gitattributes?

Upvotes: 5

Views: 3675

Answers (1)

bk2204
bk2204

Reputation: 76579

git lfs track does two things: modify .gitattributes and adjust timestamps so that Git picks up any existing files and converts them to LFS objects. In addition, it does some sanity-checking to avoid duplicates and common mistakes.

There's no reason you can't just modify .gitattributes yourself, but note that if you do that, you should also run git add --renormalize . to make sure that any existing files matching the relevant patterns are converted to LFS.

Upvotes: 11

Related Questions