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

Re: [BUG] git clean -d is too greedy

From
HSHermanni Suominen <hermanni@foobar.fi>
Date
Nov 2, 2017, 18:04 UTC
Message-ID
<1b6ba313-8d99-8604-1774-0f481eeeabec@foobar.fi>
In-Reply-To
<d2e823e2-800d-17ba-c9d4-f490cefefd2f@foobar.fi>

I was a bit trigger happy posting this, after digging a bit more this is a way more serious than I originally thought.

>    1) .gitignore exists in nested repo (either tracked or untracked)
>    2) .gitignore is excluded
This can be any file, including those commonly excluded such as *~.

Demonstrating this in a way that looks a lot more likely use case which will potentially wipe out lots of uncommitted work:

# git init -q foo && cd foo # git init -q bar && cd bar # touch bar bar~ # git add bar && git commit -qm asd && cd .. # git clean -e \*~ -dn Would remove bar/bar

If there were more tracked files in nested repo they'd be removed as well as long as there is at least one excluded file in nested repo.

-- 
Hermanni
Previous: Hermanni Suominen
Message 2 of 2 in “[BUG] git clean -d is too greedy”
  1. Hermanni SuominenNov 2, 2017
  2. Hermanni SuominenNov 2, 2017

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.