Dev Notes

Software Development Resources by David Egan.

Gitignore Directory Contents


git
David Egan

You may need to gitignore the contents of a directory, whilst including the empty directory in version control.

For example, you have a config directory that contains config files that are app specific. It may useful to include the config directory, so you can easily see where to place config files.

To achive this, add a .gitkeep file to the directory. Then in the repository’s .gitignore file:

config/*
# exception to the rule
!config/.gitkeep

comments powered by Disqus