1

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/*
MEM
  • 30,529
  • 42
  • 121
  • 191

1 Answers1

3

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.

Community
  • 1
  • 1
tiwo
  • 3,238
  • 1
  • 20
  • 33
  • If you are excluding all files inside that folder, do not forget to exclude the .gitignore file itself. `!.gitignore` – gbc921 Feb 11 '14 at 14:42