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

Re: [RFC] git clean --local

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 2, 2018, 04:43 UTC
Message-ID
<xmqqo9a4ilm8.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<xmqqsgzgiyk2.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> Cameron Boehmer <cameron.boehmer@gmail.com> writes:
>
>> 1) add a new flag
>> -l, --local
>>     Do not consult git config --global core.excludesFile in
>> determining what files git ignores. This is useful in conjunction with
>> -x/-X to preserve user files while removing build artifacts.
> ...
> But it might be useful as an option that affects any "git" command,
> e.g. "git --local-config-only clean".  I dunno.
If you only want to say "there is no global excludes file", perhaps
    $ git -c core.excludesFile=/dev/null clean -x

may be sufficient, so for that particular use case, there is no need to introduce a new command, I'd think.

In the longer term, however, I think we would want to introduce a distinction among ignored files---we only support "ignored and expendable" class, but not "ignored but precious" class. With the latter class introduced, it would make sense for "git clean -x/-X" to notice that a path is ignored but precious and keep it. If a dir/foo is ignored, dir/bar is tracked in commit A that is currently checked out, and there is no dir/ directory in commit B, checking out commit B would remove dir/foo (because the last tracked file in the directory goes away and all remaining files in the directory would be ignored but expendable). But if we introduced a new "ignored but precious" class and made dir/foo a member of such a class, then you will be prevented from checkout out B until you do something about dir/foo that is now "precious".

Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 3 of 8 in “[RFC] git clean --local”
  1. Cameron BoehmerDec 1, 2018
  2. Junio C HamanoDec 2, 2018
  3. Junio C HamanoDec 2, 2018
  4. Ævar Arnfjörð BjarmasonDec 2, 2018
  5. Randall S. BeckerDec 2, 2018
  6. Junio C HamanoDec 2, 2018
  7. Cameron BoehmerDec 3, 2018
  8. Junio C HamanoDec 4, 2018

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.