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 :)
Written by Dennis Micky Jensen
Related protips
1 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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#