简体   繁体   中英

Possibly Squashing Git History To Save Space

I'm not entirely sure how git handles the commit history, but essentially my situation is that I have developed a game using Unity and I have large assets and binary files (images and sound files etc) that are stored remotely using GitLfs to avoid filling up disk space locally and remotely.

I recently got rid of my GitLfs subscription since I finished my project, but I still want to host my code on GitHub so others can see. What is the best way to do this because I don't think I can just push the entire project to GitHub since its fairly large (and its probably not best practice either).

Maybe I could squash the git history to reduce the size of project since I think the way git history works (don't quote me on this) is that it stores the state of every file in every commit. And since large binary files go unchanged, its rather redundant and a waste of space. Any advice would be appreciated.

Media/asset files are best stored somewhere other than in source control. You can remove a file entirely from your git history with

git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch path_to_file' HEAD

Your readme could include instructions for how to download the large files which are necessary for your application.

Once you've purged your git history of any large files, it would be good to use a fully developed ' enter link description here .gitignore'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM