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