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

Re: [RFC] git clean --local

From
CBCameron Boehmer <cameron.boehmer@gmail.com>
Date
Dec 3, 2018, 07:40 UTC
Message-ID
<CAM+q9MfiycW6kXRLHsseKp+n1k9goALjRY-ePke2vYDhqcpD=g@mail.gmail.com>
In-Reply-To
<xmqqk1kriuu8.fsf@gitster-ct.c.googlers.com>
Show 8 quoted lines
> > Would something like git clean --exclude=file-pattern work as a
> > compromise notion? Files matching the pattern would not be cleaned
> > regardless of .gitignore or their potential preciousness status
> > long-term. Multiple repetitions of the --exclude option might be
> > supportable. I could see that being somewhat useful in scripting.
>
> I think "git clean" already takes "-e", but I am not sure if it is
> meant to do what you wrote above.

It does already take --exclude=file-pattern, which is like adding lines to .gitignore. (W/o -x/-X, that would mean DON'T clean them, but with -x/-X, it means DO clean them.)

Show 7 quoted lines
>
> If "git clean" takes a pathspec, perhaps you can give a negative
> pathspec to exclude whatever you do not want to get cleaned,
> something like
>
>         git clean '*.o' ':!precious.o'
>
I like this, but I'm also 100% satisfied with Junio's previous suggestion:
    git -c core.excludesFile=/dev/null clean ...
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 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.