How to add an empty directory to a Git repository

How to add an empty directory to a Git repository
0

#1
  1. Create the directory. Git will not track an empty directory, but use the following trick.
  2. Inside that directory, create an invisible file in that directory called “.keep” by running this command in your MacOS / Linux terminal: touch .keep
  3. Now when you run git status you’ll see that Git is now recognizing and tracking the directory!

Note that you can call this file whatever you want - the . at the beginning makes the file invisible, and the keep is just a standard way of naming these types of files in Linux.

Happy coding!