Subject: Re: [RFC] Define "precious" attribute and support it in `git clean`

From: Josh Triplett <[email-masked]>
Date: Tue, 10 Oct 2023 22:10:25 +0800

On Tue, Oct 10, 2023 at 03:38:51PM +0200, Kristoffer Haugsbakk wrote:
> Hi Sebastian
> 
> On Tue, Oct 10, 2023, at 14:37, Sebastian Thiel wrote:
> > This highlights precious files by calling them out, but doesn't change the
> > behaviour of existing flags.  Instead, the new flag `-p` is added which lets
> > `git clean` spare precious files.
> 
> Why can't `clean` preserve precious files by default? And then delete them
> as well with something like `--no-keep-precious`? Is there some backwards
> compatibility concern?

While I'd love for it to default to that and require an extra option to
clean away precious files, I'd expect that that would break people's
workflows and finger memory. If someone expects `git clean -x -d -f` to
clean away everything, including `.config`, and then it leaves some
files in place, that seems likely to cause problems. (Leaving aside that
it might break scripted workflows.)

It seems safer to keep the existing behavior for existing options, and
add a new option for "remove everything except precious files".