How to force git to keep a directory but bypassing all the files that are inside it?
I have a certain folder and
logswhich is essential for the operation of my application. I'd like to add the same in my repository, for those who replicate don't want to be creating the same when doing it
git clone. But the detail is that log files should not go to the repository, but only the folder.
How to do that?
To do this in
gitjust add a file
.gitignoreinside the desired folder and then determined that all files except the
.gitignorewill be ignored inside that folder.
.gitignorewhich is inside the folder
Now just use the command
git add logs/. Thus, the folder
logswill be added to the repository, but the log files of this folder will be ignored.
I usually use this a lot for upload folder that needs to exist, but I don't need the files that are in it.