0

I wanted to check in a folder skeleton to my git repo. The idea was that other people can just copy the folder and use / modify it in their repositories as a template folder.

Since git does not allow checking in empty repositories my preferred solution would be to add a .keep file to every subfolder. This would allow any folder to get checked in.

matt3o
  • 615
  • 1
  • 5
  • 17
  • Is your question really "How can I easily/quickly add a .keep file to all directories in my working folder?" ? It seems you're asking how to ask git to commit empty folders (title) then go on about how this isn't possible and that you've already come up with the solution, but you don't actually ask a question. – Lasse V. Karlsen Apr 10 '17 at 08:22
  • Actually I wanted to document the solution. I found hints for it at different places and wanted to keep track of the command. I proposed a way to solve this in the question and I see your problem with that. For all I know using .keep files is a good way to actually solve the problem but if you have any other solutions I'm totally open to it - checking in lots of empty folders is what this question is about. – matt3o Apr 10 '17 at 08:29
  • Then you should explicitly write up that as part of the question, ie. something like "How do I quickly and easily add all these files without doing it manually?" and then make sure you post either which operating system or similar this is on as the answer you've posted will not work on Windows. – Lasse V. Karlsen Apr 10 '17 at 09:15

1 Answers1

1

The following command does exactly the task - it recursively creates .keep files in every folder.

find . -type d  -exec touch {}/.keep \;

Now you can add the .keep files and thus also all the folders.

matt3o
  • 615
  • 1
  • 5
  • 17