When we push a certain project somewhere, we wish to deploy empty necessary folders too. For example: /runtime/ folder.
However, we must ignore all files inside /runtime/* ;
I’m aware of “the create a useless file inside your empty directories” solution and also, aware of some sort of bash process to make that add of useless files automatic, but isn’t there any other way?
I mean:
Is it possible to accomplish this by having on our .gitignore something like:
!/runtime/
/runtime/*
No, not currently. The standard trick relies on having a file (
somedirectory/.gitignore) in the directory, since git does not stage empty directories, no matter what/.gitignoremay say.It is currently not possible to
git addan empty directory.