w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to commit directory structure (directories with subdirectories) without files to git?

Your .gitignore file ignored directory /web/uploads itself therefore its subdirectories and files will be ignored automatically regardless the following negated pattern.

If you want to add /web/uploads/ but ignore files in it, the .gitignore can be like:

/web/uploads/*
# Next line tell git to add subdirectories back
!/web/uploads/**/
!/web/uploads/avatars/.gitkeep
!/web/uploads/video/.gitkeep

Or if you just want to add the directory, no matter there is file or no, then you don't need to touch .gitignore, just add the .gitkeep files, everything will work well.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.