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

Re: git clean --exclude broken?

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Nov 24, 2024, 18:12 UTC
Message-ID
<Z0Nsq3lQZKJZxd-y@tapette.crustytoothpaste.net>
In-Reply-To
<1A13EB2A-6075-4CA9-855E-B72ACDA67C0C@gmail.com>
On 2024-11-24 at 11:10:57, Homyee King wrote:
Show 9 quoted lines
> 13 years ago, Todd Rinaldo found that —exclude option is not works
> with any options, for example, `git clean -Xd -e=foo` to clean the
> files/folders respect the .gitignore rule except the foo, but in real
> world, git only respect the git ignore standard rule and not work with
> -e option.
> 
> Today, 13 years later, the problem still exist, so I wonder is this a
> bug or should we clarify the “correct” usage of exclude in
> documentation, because it’s really confusing.

I don't think this is the right syntax. For example, I did this in my checkout of the Git project:

---- $ touch foo $ git clean -n Would remove foo $ git clean -n -e foo $ git clean -f -e foo $ ls foo foo ----

When you use a short option, you don't specify the equals sign. So you can write `-e foo`, `-efoo`, `--exclude foo`, or `--exclude=foo`. However, `-e=foo` is equivalent to `-e =foo`, which ignores `=foo`.

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: Homyee KingNext: brian m. carlson
Message 2 of 4 in “git clean --exclude broken?”
  1. Homyee KingNov 24, 2024
  2. brian m. carlsonNov 24, 2024
  3. brian m. carlsonNov 28, 2024
  4. brian m. carlsonDec 10, 2024

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.