We have a repository with multiple branches and merge commits. There was some disagreement at the start on whether we wanted to use LFS or not, and the result was that no files have yet been tracked with Git LFS. Now, however, we've run into issues and we would like to migrate the entire repository history, including all branches and merges, to use LFS for files specified in a new .gitattributes file. Note that this .gitattributes file is not part of the repository history.
So far, we've tried a few variations on git lfs migrate import --everything
without success. When using the --fixup
option, the history is rewritten but nothing gets tracked by LFS. Without that option, the migration modifies our .gitattributes file and adds EVERY file type in the repo, plain text files included. We haven't yet been able to get it to respect our .gitattributes the way it was written, without modification. We tried committing our .gitattributes before the migration as well as not committing it, and also explicitly running git lfs track
before the migration as well as not doing that.
We've looked at existing SO questions, but none of the answers seem to match our situation. Here are some of the others that we looked at:
- Git LFS git lfs migrate import include all file types specified in .gitattribute?
- Git-LFS migrate using the new .gitattributes file
- How to use Git LFS and re-write history
Any help is greatly appreciated. Thank you!
Postscript: We understand that we could probably use the --import
option repeatedly to make migrate re-create the desired .gitattributes, but I'd love to know if this is doable without that.