A .gitkeep file tells github to do the opposite of its default behaviour, which is to ignore empty folders.
If you want to track an empty folder, or a folder with untracked files, create a 0kb file with the .gitkeep file extension in that folder.
touch FOLDER_NAME/.gitkeep
To create a .gitkeep file in each of your folder subdirectories, run this bash script from the root of your source project:
find . -type d -empty -not -path "./.git/*" -exec touch {}/.gitkeep \;
Here is the PowerShell equivalent:
Get-ChildItem -Recurse -Directory | ForEach-Object {New-Item -ItemType file -Path "$($_.FullName)" -Name ".gitkeep" }
If you want to ignore everything inside the directory, but at the same time want to check-in the folder, add the following lines in your .gitignore:
# ignore files in folder
FOLDER_NAME/*
# ...but keep the folder
!FOLDER_NAME/.gitkeep