Sometimes end up with visible and hidden content folder after using git

Sometimes, when I’m working on a site, I end up with a blank, invisible folder or directory which breaks the Kirby install. It’s a duplicate folder though, but the real, visible folder which still has content, cannot be reached by Kirby. It breaks the site but all I have to do is go in and remove the empty, invisible folder with the same name as the visible folder (but without the numeric prefix). I’m just worried it may happen on a production site someday when I’m not watching closely.

I think it may have something to do with how git tracks the folders. It also adds the same number to two different, visible folders.

Here’s the resulting, folder structure that, in this case, prevents the ‘transportation’ feature from working:


Has anyone else ever seen this behavior?

This happens when you change folders from visible to invisible without committing the deleted folders.

Thank you @texnixe, I thought I had changed that behavior by switching to git add --all which should add deleted folders to the commit, right?