From: Jan Berges Date: Sat, 08 Feb 2025 09:43:36 GMT Subject: Re: git clean -Xdf affects parent and sibling directories Message-ID: <111052b2-b64e-4146-b8eb-45ee27402ddc@uni-bremen.de> In-Reply-To: On 2/7/25 22:24, Junio C Hamano wrote: > The command should take the usual pathspec, so "git clean ." should work as expected. Thank you for the explanations! I tried again with "git clean -Xf -- ." and this command still removes parent and sibling content. This seems to be at odds with the manual: "If any optional ... arguments are given, only those paths that match the pathspec are affected." As far as I can see, if is untracked and ignored, the command goes to the topmost ignored directory of the tree and cleans from there. In the worst case, GIT_WORK_TREE=$HOME, GIT_DIR tracks dotfiles, and all other directories such as ~/Documents/ are ignored. Running the command in ~/Documents/path/to/another/repository/ would remove everything under ~/Documents/. (This is not exactly what I did; I did not lose any files. In any case, thanks for the advice to always do a dry run first!) Jan