I have an uploads folder in my project that I need git to track.
Both the folder itself and all subfolders (I mean
uploads,
uploads/users,
uploads/users/profiles,
uploads/users/profiles/pics
and other paths like those) should be tracked.
I have added an empty file named .gitkeep
to all folders and my .gitignore
is as follows:
uploads/*
!.gitkeep
but git is not tracking the subfolders.
===============================================================
After CodeWizard suggestion for creating .gitkeep files via command and no solution to force git to ignore all files in a directory and childs except the ones having .gitkeep file. i used this command to git-add -f all .gitkeep files created under uploads directory.
find . -name '.gitkeep' | xargs git add -f