0

I have an existing Git repo that contains some large files, which are stored regular (blobs, I think is the term?). I want to enable Git LFS, and re-write history to make it look like LFS has been in use the whole time.

Currently, the revision history looks roughly like this:

  1. Add a .bin file.
  2. Delete that .bin, add a different .bin.
  3. Repeat that several times. This includes branches and merges to master.

I would like the revision history to look like this:

  1. Add the .gitattributes file that specifies LFS tracking for .bin files.
  2. Add a .bin file (stored in LFS).
  3. Delete that .bin, add a different .bin (stored in LFS).
  4. Repeat that several times. This includes branches and merges to master.

What I've done so far:

  • On my existing repo, I did git lfs install, git lfs track *.bin. This resulted in two modifications, to .gitattributes and to the existing .bin file, which I was able to commit. (I haven't merged this to master, so I can easily abandon it if needed.)
    • I've seen other answers that say to do git rm --cached followed by git add. Since the call to git lfs track *.bin resulted in a pending modification to by .bin file, I assume that guidance is outdated.
  • I tried reading through the LFS Migrate documentation, but all of the Git documentation is written from the perspective of someone that knows and understands Git's underlying storage mechanisms, and that's not me, so I didn't really understand it.

The repo that I'm trying to migrate to LFS doesn't have many branches other than master. If branches other than master don't get migrated and need to be re-created, that would be OK.

David Yaw
  • 27,383
  • 4
  • 60
  • 93

0 Answers0