git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Add a way to disable «git clean» per repo
@ 2023-04-01 20:50 Guillem Jover
  2023-04-03 17:36 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Guillem Jover @ 2023-04-01 20:50 UTC (permalink / raw)
  To: git

Hi!

[ I initially filed this in the Debian bug tracking system as it
  seemed to me that filing a feature request on a mailing list had
  a great potential to get lost. But I guess I can try anyway. :) ]

For repositories that are not tracking code, say when storing your ~/
under git, or to store say collections of data files such as photos,
texts or similar, you might end up using .gitignore to unclutter
«git status». The problem is that both ignored and non-ignored
untracked files can be “precious”, as in not version-tracked by losing
them might imply data loss.

Accidentally running «git clean -xdf» or «git clean -Xdf» might be
catastrophic there. But for the ~/ case (or any such tracking in a
parent of git trees, this is even worse, as an accidental «cd» too
much while in some code repo might end up accidentally recursively
running those «git clean» on an unexpected working tree and all of
its subdirectories (except for other git working trees).

I tend to be rather careful with this, but I recently had a scare
where this happened to me, and lost a few (not essential) files before
I noticed and Ctrl-C'd git. I then set out to try to disable git clean
on these situations, but I see no way to do that as aliases do not work
with built-ins, and adding a ~/bin/git wrapper to check for this seems
extremely cumbersome.

It would thus be nice if there was an option that could be set to
completely disable «git clean» on a repo. I guess it might make sense
to disable for any untracked file, or perhaps for ignored and/or
non-ignored. So that these kind of work trees could be protected.

Thanks,
Guillem

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-10 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-01 20:50 Add a way to disable «git clean» per repo Guillem Jover
2023-04-03 17:36 ` Junio C Hamano
2023-04-09 17:01   ` Guillem Jover
2023-04-10 13:32     ` Thomas Guyot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).