Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore files >100MB in your Git repos #43

Closed
sr320 opened this issue Feb 11, 2015 · 2 comments
Closed

Ignore files >100MB in your Git repos #43

sr320 opened this issue Feb 11, 2015 · 2 comments

Comments

@sr320
Copy link
Owner

sr320 commented Feb 11, 2015

via @kubu4

Easiest way I've found to ignore those large files is the following:

In the shell:

  1. Change to your Git repo directory
  2. find ./* -size +100M | cat >> .gitignore

The command explained:

Find all files in my current directory, and all those directories contained within, that are >100MB. Concatenate this list to the .gitignore file.

@sr320 sr320 closed this as completed Mar 9, 2015
@shivam13juna
Copy link

We need to remove the "./" then, .gitignore works, this command does that.

find . -size +1G | sed 's|^./||g' | cat >> .gitignore

@petre-c
Copy link

petre-c commented Apr 7, 2024

The command above will add large file paths to .gitignore, even if they're already present in the file.

Below script will add files larger than 10M to .gitignore and then remove duplicate entries from it:

find . -size +10M | sed 's|^./||g' | cat >> .gitignore
sort .gitignore | uniq  > temp_file && mv temp_file .gitignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants