Permalink
Browse files

Add .empty files to empty directories so git preserves them.

  • Loading branch information...
1 parent cf32baf commit 6ccfc0ebdedb53794c4981521c4299d842caf896 @josh josh committed Apr 22, 2008

8 comments on commit 6ccfc0e

@nigelramsay

why not use .gitignore files instead?

@josh
Member
josh commented on 6ccfc0e Apr 24, 2008

git doesn’t track empty folders, we need to put a dummy file there so the tests pass.

@augustl

it’s common to put a empty .gitignore file in empty folders, think than was his point

@pusewicz

Yeah, just rename .empty to .gitignore, it’s a good practice.

@trevorturk

I heard using .gitignore was standard practice and have been doing it as well. It makes sense to me, because it lets you know the reason the files are there.

@josh
Member
josh commented on 6ccfc0e Apr 24, 2008

Gotcha!

@nate
nate commented on 6ccfc0e Apr 24, 2008

to add .gitignore files to all empty directories recursively from your current directory
find . ( -type d -empty ) -and ( -not -regex ./.git.\* ) -exec touch {}/.gitignore \;

@andmej
andmej commented on 6ccfc0e Sep 10, 2008

Nice trick, nate!

Please sign in to comment.