4
Some people told me that the correct thing is to create an empty file and put inside each folder and set one .gitignore
thus:
/pasta/subpasta/*
!/pasta/subpasta/.arquivovazio
And other people told me to create a . gitignore file inside each folder with the following content:
# ignorar todos
*
# exceto o .gitignore
!.gitignore
Create a single file .gitignore
or one in each folder? What is the best alternative?
Remembering that the two forms were tested and worked.
I think the answer potentially borders on the question of personal opinions. My answer is one, so I put it as a comment and not as an answer. I’d rather create a single file and keep keeping to it than keep creating a file for every folder I create. Decreases the amount of files that both Git and I have to keep paying attention to.
– Oralista de Sistemas
Nice, I found that point of view interesting.. But here’s the question, what’s the difference between creating an empty file in each folder or putting a gitignore? changes something pro git? because doing the way you said I would need to create an empty file equal in each folder, otherwise it does not versiona..
– Alexandro Zaleski
I never thought about it, but I also never had to create a project with empty directories. I do not see the need, perhaps because I have never had this requirement. If I really needed directories that won’t contain anything, I would let the application create them as needed and at the time of use, but wouldn’t keep directories in the repository.
– Oralista de Sistemas
Yes, I agree with you but in my case today I have some websites that need, for example in some use Smarty and it generates the files within templates_c and I have no way to create it through the application, so I need to have it in version control.. and there are some providers, for example the kinghost that won’t let me create folders, give them permissions through php, so I need to have the image folders that the client registers in the empty version control for not Versing test images for example
– Alexandro Zaleski
One possible solution would be to use a . gitpeak file in empty directories. question of the OS will help you understand better.
– Nocttuam
I don’t know gitpeak, I’ll take a look.. Thanks for the tip
– Alexandro Zaleski
If your application is php, put an index.php instead of a hidden file or something like that. This way you add a simple layer of security to your application.
– ppalacios