nikUnique
Published on

Managing Big Files and Git Repository

Authors
  • avatar
    Name
    nikUnique
    Twitter
File CabinetFile Cabinet

🚨 Understanding the Big File Problem

Git is designed for tracking source code, not large files. When developers accidentally commit large files like videos, datasets, or something else, it can cause several issues:

  • The repository size is unnecessarily big
  • Slow clone and fetch operations
  • Increased storage and bandwidth consumption

💡 Strategies for Handling Large Files

  1. Git Large File Storage (LFS)

    Didn't try it personally, so cannot say how good it is, but if you are interested, you can go to git-lfs.com.

  2. External Storage Solutions

  • Use cloud storage (Google Drive, Dropbox, Mega)
  • Use URL links to reference large files

🚫 Removing Large Files that are Already Commited

In my case, I committed some big files to my local repository, and when I wanted to push it to a remote repository — it didn't allow it because of a bigger repository size than was allowed, and even after deleting these files in the project, when I tried to push it to a remote repository, it still contained them. I searched for a solution to remove them, and I found it on junyonglee.me blog. It worked pretty well for me, although there are recommendations to use git-filter-repo instead, so be cautious about using this. Backup your repository first.

Conclusion

Managing large files in Git requires a proactive approach. By understanding these strategies and implementing Git LFS or using cloud storage options, you can maintain a lean, efficient repository.