How to revert implementation of Git LFS in a repository?

24 Views Asked by At

I installed Git LFS in a shared repository because we were storing large files outside of it and it allowed us to centralize our data. However the repository has ballooned in size, and I want to store these large files outside the repository again.

My questions pertain to reverting Git LFS and how to handle the presence of these large files in git history. I am planning to remove tracking from the repository as such:

Actions to Revert Git LFS:

  1. Move large files to new location outside repository
  2. Uninstall from repository (git lfs uninstall)
  3. Delete tracking configurations (rm .gitattributes)

I feel confident these are the proper actions for removing LFS from the repository. However, I am concerned that they will still be taking up space in the git history. I did install LFS just two weeks ago, and there have been about a dozen commits since. I'm guessing I could copy my most recent non-LFS commits, revert to the commit prior to LFS, and reintroduce the copied commits. I'm not rehearsed in Git very well, so I would really appreciate help answering the following questions:

  1. Even if Git LFS is uninstalled from a repository, won't the size of the repository remain unchanged since they will still be present in the commit history?
  2. If so, can anything be done to remove these specific instances? Or to reduce the size of the .git folder?

I've since come across the git lfs migrate export command, which may be what I am looking for.

0

There are 0 best solutions below