Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitignore by file size?

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?

like image 626
Warren Benedetto Avatar asked Oct 27 '10 17:10

Warren Benedetto


People also ask

How do I Gitignore a csv file?

Open the .gitignore and ignore .csv filesIn your text editor, open the . gitignore file and add *. csv under 'Ignored files'. This tells git to ignore any file that ends with .

Can't push to github because of large file which I already deleted?

Delete large file. then click on the "view"(window file) view-> check hidden folder then you will be able to see '. git' file delete . git file this will delete all your commit history Then you can push your repo like new one...

What is the format of Gitignore?

gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in the root folder of the repository, and that's what I recommend. However, you can put it in any folder in the repository and you can also have multiple . gitignore files.


1 Answers

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.

like image 131
abendine Avatar answered Sep 20 '22 01:09

abendine