Last Updated: April 07, 2016
·
16.82K
· mewm

Git: Keep empty directories tracked, but not contents

If you need to track an empty directory, but you don't need the content to be tracked, you can put this in a .gitignore in the specific directory;
*
!.gitignore

If you need the empty directory to be tracked to start with, and later the contents, just put a .gitkeep in the directory :)

1 Response
Add your response

You can also put a .gitkeep in, check only that file in the index, then add an entry in the global .gitignore for that entire directory. Works just as well— both techniques have different advantages.

over 1 year ago ·