"Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: Elijah Newren <newren@xxxxxxxxx> > > If a user deletes a file and places a directory of untracked files > there, then stashes all these changes, the untracked directory of files > cannot be restored until after the corresponding file in the way is > removed. So, restore changes to tracked files before restoring > untracked files. > > There is no similar problem to worry about in the opposite directory, direction, I think. If a user deletes a directory with tracked files in it and places an untracked file at the path the directory used to be, and then stash all these changes, that would be the opposite direction, I would presume? The untracked file would be restorable only after applying the removal of the tracked files that occupied the directory. Which would be fine if we apply the changes to the tracked ones first. OK. After creating a stash, we clear the working tree. How do we do that exactly, and would we have a similar problem there? We need to first remove the untracked file that currently occupies where the directory used to be in HEAD, and then create the directory and resurrect the tracked files in the directory from HEAD, in my modified example above. In the file-becomes-directory scenario, is the story the same? Thanks.