Track Empty Directories with git
There are times when you'd like to track an empty directory within git but there's a problem: git wont allow you to add a directory that doesn't have a file in it. The easy solution is putting an empty stub file within the directory, and the industry standard for that stub file name is .gitkeep.
You can quickly create the file and commit the "empty" directory from command line:
touch my-empty-dir/.gitkeep
git add my-empty-dir/.gitkeep
git commit -m "Adding my empty directory"
The problem is simple, the solution is easy, but I wanted to highlight that .gitkeep is the industry standard.
![CSS @supports]()
Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS. What we end up doing is repeating the same properties multiple times with each browser prefix. Yuck. Another thing we...
![Vibration API]()
Many of the new APIs provided to us by browser vendors are more targeted toward the mobile user than the desktop user. One of those simple APIs the Vibration API. The Vibration API allows developers to direct the device, using JavaScript, to vibrate in...
![CSS :target]()
One interesting CSS pseudo selector is :target. The target pseudo selector provides styling capabilities for an element whose ID matches the window location's hash. Let's have a quick look at how the CSS target pseudo selector works!
The HTML
Assume there are any number of HTML elements with...
![Fix Anchor URLs Using MooTools 1.2]()
The administrative control panel I build for my customers features FCKEditor, a powerful WYSIWYG editor that allows the customer to add links, bold text, create ordered lists, and so on. I provide training and documentation to the customers but many times they simply forget to...
If you want to keep empty directory in git and be sure that its eventually content won’t be pushed, you have to add line in
.gitignore. Going to the point,.gitkeepis one of the methods and the more common (from my experience) is to create.gitignorewithI’d be interested where the “
.gitkeepis the industry standard” came from. Last time I was looking at a couple of repositories, the preference was an empty.gitignorefile.Good tips, Mathew and David!
@Mathew: When I use this tip, I usually include
*/as well to exclude subfolders. This can be pretty handy for thoselog/,cache, andsessionstypes of directories.