git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Please consider extending .gitignore to support setting of a file size limit

From
Junio C Hamano <gitster@pobox.com>
Date
May 7, 2015, 21:31 UTC
Message-ID
<xmqqy4l0m5wf.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAC+AdWRpJnt2PN1YcB7VoHcKsO86_DhE1mOB5Ls9bWaEd_XKXQ@mail.gmail.com>
Roger Mendes <sproger1@gmail.com> writes:
> Allow .gitignore to support setting a file size limit so that all
> files over a certain size will by automatically ignored when
> performing git add, commit -a...;
No.

I would not say that it would not make sense to have a method to tell your Git to reject an attempt to add certain files to the index, but .gitignore is make that decision based on paths and is a bad place to do any other decision, so take the above "No" as "No, we do not consider butchering .gitignore for that", not as "No, you shouldn't base your decision on file size".

Also, once the path is tracked, then "git add" will keep tracking it unless and until you "git rm --cached" it. So you may "git add" a 1kB file, grow the file to 500MB and then the next "git add" should register the updated contents to the index. Whatever you do when designing that new feature, you should need to take that into account.

Having said all that, why is it that you do not want to track certain files that happen to be large? Don't the existing large file support facility work for you (or perhaps you are not using them)? It might be that your time is better spent on improving that, instead of working around the issue, no?

Previous: Roger MendesNext: Thomas Koch
Message 2 of 7 in “Please consider extending .gitignore to support setting of a file size limit”
  1. Roger MendesMay 7, 2015
  2. Junio C HamanoMay 7, 2015
  3. Thomas KochMay 8, 2015
  4. Kevin DaudtMay 8, 2015
  5. Fredrik GustafssonMay 8, 2015
  6. Stefan BellerMay 8, 2015
  7. Philip OakleyMay 8, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.