admin管理员组

文章数量:1122846

I recently started using Git LFS and followed the documentation, which states that only new files matching the tracked patterns will be stored with Git LFS. To include existing files, the documentation mentions using git lfs migrate.

Here’s what I did:

Installed Git LFS and tracked these pattern:

git lfs track "*.jpg"

Ran git add -A and noticed older files in the staging area. Committed and pushed to the main repository. When I checked GitHub, older files already in the repository were marked as 'Stored with Git LFS', even though I didn’t run git lfs migrate.

My understanding was that older files wouldn’t be affected unless migrated. So my question is:

  • How could older files already be stored with Git LFS if migration wasn’t performed?
  • Is the documentation incorrect or am I misunderstanding how Git LFS handles old files?

Thanks for any clarification!

I recently started using Git LFS and followed the documentation, which states that only new files matching the tracked patterns will be stored with Git LFS. To include existing files, the documentation mentions using git lfs migrate.

Here’s what I did:

Installed Git LFS and tracked these pattern:

git lfs track "*.jpg"

Ran git add -A and noticed older files in the staging area. Committed and pushed to the main repository. When I checked GitHub, older files already in the repository were marked as 'Stored with Git LFS', even though I didn’t run git lfs migrate.

My understanding was that older files wouldn’t be affected unless migrated. So my question is:

  • How could older files already be stored with Git LFS if migration wasn’t performed?
  • Is the documentation incorrect or am I misunderstanding how Git LFS handles old files?

Thanks for any clarification!

Share Improve this question asked Nov 22, 2024 at 12:02 ArtoriasArtorias 32 bronze badges 1
  • GitHub may simply be misrepresenting historical commits as if current attributes applied. – jthill Commented Nov 23, 2024 at 21:33
Add a comment  | 

1 Answer 1

Reset to default 0

Looks like older files were handled by Git LFS because they were staged and committed after the .gitattributes update.

Migration (git lfs migrate) is only required for files already committed in previous history. The behavior is normal according to the Git LFS documentation.

Link: CLICK

本文标签: git lfsWhy are old files automatically stored with Git LFS without migrationStack Overflow