gitignore by file size?

北慕城南 提交于 2019-11-27 05:13:41

问题


I'm trying to implement Git to manage creative assets (Photoshop, Illustrator, Maya, etc.), and I'd like to exclude files from Git based on file size rather than extension, location, etc.

For example, I don't want to exclude all .avi files, but there are a handful of massive +1GB avi files in random directories that I don't want to commit.

Any suggestions?


回答1:


I'm new to .gitignore, so there may be better ways to do this, but I've been excluding files by file size using:

find . -size +1G | cat >> .gitignore

Obviously you'll have to run this code frequently if you're generating a lot of large files.




回答2:


I wanted to also offer a Windows version of this as well.

forfiles /s /c "cmd /q /c if @fsize GTR 1073741824 echo @relpath" >> .gitignore


来源:https://stackoverflow.com/questions/4035779/gitignore-by-file-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!