So I see Git doesn't recognize folders, or should I say when the only change between commits is addition of empty folders to the working tree they're not show in git status
after git add .
.
How would you handle the need to add empty folders to the working tree (for runtime storage) and have them be reflected/created when other repositories pull from the current repository (one in which the folders were added)?
Since Git won't track empty directories, you have to trick it into doing so by adding a file in the directory to Git's index. Usually, people store a file called . gitkeep in a directory that they wish to track, but where the directory should stay empty for the time being.
Git doesn't ignore empty directories. It ignores all directories. In Git, directories exist only implicitly, through their contents. Empty directories have no contents, therefore they don't exist.
Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.
I usually put a .gitignore
in those directories as you likely want to ignore any runtime generated data anyway.
People often put an empty file as a placeholder in the folder to overcome that limitation...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With