Hey Hilco, I'm not sure exactly what you did because you didn't give a list of git commands, but I'm guessing you ran into the fact that git doesn't track empty directories. For instance if I do: (in repo on your branch) mkdir test_dir touch test_file git add * git commit -m "test commit" test_file will be tracked but test_dir will not (because it is empty). To avoid this problem, a convention is to add an empty ".gitkeep" file to directories. For example: (in repo on your branch) mkdir test_dir touch test_dir/.gitkeep touch test_file git add * git commit -m "test commit (with directory)" Will commit the directory as expected in your branch, and when you go to checkout another branch it will not exist. Hope that helps. Sorry if you already know this and I misunderstood your question. Evan Shelhamer On Wed, Aug 17, 2011 at 2:35 PM, Hilco Wijbenga <hilco.wijbenga@xxxxxxxxx> wrote: > Hi all, > > I have been noticing strange behaviour that I would like to be able to > explain or report as a bug as the case may be. > > What happens is that I create and commit a new directory in branch > 'next' and then when I checkout 'master' this new directory is still > there. I think this is wrong as this new directory does not exist yet > in 'master'. Is my understanding correct? > > I tried recreating this scenario in a clean Git repo with a simple > mkdir and commit but when I did a checkout of 'master' the new > directory was removed. So the basic scenario seems to work the way I > expect it to. > > Assuming I ran into a bug, I would like some suggestions to properly > investigate this. Clearly, I'm doing something else that triggers the > behaviour I'm seeing but I'm not sure what it is. What might trigger > Git "remembering" a directory? Or what would prevent it from removing > a directory when checking out a different branch? > > Extra information: "git status" (in 'master') yields nothing. But > after adding a new file in the directory-that-should-not-be-there, Git > treats the entire directory as untracked and new (as one would > expect). I can also safely remove the directory with no (obvious) ill > effects. > > Cheers, > Hilco > -- > 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 > -- 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