allow folder creation but ignore all files inside

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 /.gitignore may say.

It is currently not possible to git add an empty directory.

链接地址: http://www.djcxy.com/p/7840.html

上一篇: 将子目录分离(移动)到单独的Git存储库中

下一篇: 允许创建文件夹但忽略里面的所有文件