I do agree there are ignored-but-precious type of files exist in practice. Introducing such ignored-but-precious class through attributes or .gitignore is fine, and the definition of the class can broadcast to others through .gitattributes or .gitignore, it's cool. But it sounds a bit complicated. This afternoon's hack on config variable "clean.requestForce" feets my needs, but it also has drawbacks: 1. Define a global "clean.requestForce" variable like this: $ git config --global clean.requestForce LockIgnored 2. Then in one repository, * You can : git clean -f * But you cannot : git clean -f -x 3. If want to override such global setting, simply $ git config clean.requestForce true The side-effect of this hack is that an unhacked git will complain: fatal: bad config value for 'clean.requireforce' in .git/config ä 11-6-3 äå11:11, Junio C Hamano åé: > Jiang Xin <worldhello.net@xxxxxxxxx> writes: > >> Untracked files may be significant for certain repositories, but if run the >> command "git clean -fdx" by accident, all untracked files will be lost. > > Don't add -x without thinking, then. It is the way to tell the command "I > want to remove all the untracked files and I REALLY MEAN IT". It is often > used to say "I do not trust Makefile and I want to remove what 'make > clean' would leave behind". > > A slightly related tangent is that we only have three classes of paths: > > - tracked ones > - untracked ones, where there are two subclasses > - unignored ones (e.g. new source file you haven't added) > - ignored ones (e.g. build artifacts like *.o files) > > and because of that, the general design is to consider "ignored" files > expendable during various operations. Sometimes people deliberately "ignore" > files that they consider not expendable, which is (by today's definition) > a wrong thing to do, but I think in the longer term we should add a way to > mark them as "ignored but precious". > > http://thread.gmane.org/gmane.comp.version-control.git/172818/focus=172846 > > Nobody has designed how this fourth class should behave (and how the > behaviour of the "ignored" should change, if any) yet, but a rough outline > would probably be: > > - precious files are the ones that are ignored (by today's definition, > i.e. .gitignore mechanism consideres they are ignored) but marked as > "precious" in some other way [*1*]. They will > > - not appear in "Untracked files:" section in "git status" output; > - not be added by "git add" without "-f", just like other ignored files; > - not be overwritten or removed to make room while switching branches; > - not be removed with "clean -f -x" [*2*]. > > - ignored files will stay to be "expendable". > > I suspect there may be some codepaths that incorrectly treat them as not > expendable, and protect their lossage. We would want to fix them after we > introduce the "precious" class. > > [Footnotes] > > *1* We could invent a way to sneak such entries in .gitignore, but I am > inclined to think it would be cleaner to define "precious" attribute and > let the attributes mechanism handle this. > > *2* This is just off the top of my head without thinking things > through. It might turn out that it makes more sense ot remove them. -- èé åäçèæäææææéåå éä: worldhello.net@xxxxxxxxx çå: http://www.ossxp.com/ ãã http://blog.ossxp.com/ çè: 010-51262007, 13910430470 äç: 010-51262007 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html