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

Re: git clean deletes negated pathspec if directory causing data loss

From
DDDevste Devste <devstemail@gmail.com>
Date
Oct 29, 2025, 20:00 UTC
Message-ID
<CANM0SV3qgqjWeAu+NvfPxeDLgo6-eRWKmi9xkpUtN6w7LJh7oQ@mail.gmail.com>
In-Reply-To
<CANM0SV3iRF=jVAFj=+rrgOC_nXEJ=_v1bUG88n3T9+PQD=a2-A@mail.gmail.com>
Anyone?
On Sun, 5 Oct 2025 at 13:33, Devste Devste <devstemail@gmail.com> wrote:
Show 23 quoted lines
>
> Just to clarify: it's not about the negation not working, but clean
> ignores the pathspec for ignored directories completely. I only want
> to delete .rej and .log files, but it will also delete gitignored
> directories (that may or may not contain any .rej or .log files)
>
> On Sun, 5 Oct 2025 at 13:27, Devste Devste <devstemail@gmail.com> wrote:
> >
> > I am using:
> > git version 2.51.0.windows.1
> >
> > Run:
> > echo .idea/dictionaries >> .gitignore
> > mkdir -p .idea/dictionaries
> > touch .idea/dictionaries/foo.xml
> > git clean -f -f -d -X --dry-run -- ':!/.idea/dictionaries' ':*.rej' ':/*/*.log'
> >
> > Outputs:
> > Would remove .idea/dictionaries/
> >
> > No matter how you specify the pathspec (':!.idea',...) it always wants
> > to delete the .idea/dictionaries directory, even though it does not
> > contain any .rej or .log files and is explicitly set to excluded
Previous: Devste DevsteNext: Johannes Schindelin
Message 3 of 5 in “git clean deletes negated pathspec if directory causing data loss”
  1. Devste DevsteOct 5, 2025
  2. Devste DevsteOct 5, 2025
  3. Devste DevsteOct 29, 2025
  4. Johannes SchindelinOct 30, 2025
  5. Junio C HamanoOct 30, 2025

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.