Flex: Cleanup .gitignore after recipe sync

Created on 5 Jun 2020  Â·  4Comments  Â·  Source: symfony/flex

I try to run monthly recipe syncs or so.

Everytime i have to clean up the same .gitignore files, would be nice if these are automatically cleaned after a recipe install/update ¯_(ツ)_/¯

e.g. https://github.com/symfony/recipes/blob/master/doctrine/doctrine-bundle/1.6/src/Entity/.gitignore

help wanted

Most helpful comment

I agree. Maybe Symfony Flex could check if there are files in that directory already and then don't sync the .gitignore file for that directory?

B.t.w. in my company we use .gitkeep files to keep empty directories in Git. As a .gitignore file suggest the intention that the file has been put there with the purpose of ignoring certain files in the directory. With .gitkeep it is clear that it's purpose is to _keep_ the empty dir in Git. I do know it is not documented and it is not officially supported by Git, but it is an industry standard. (.gitignore is documented, but not for this purpose)

All 4 comments

I also find these files annoying and I remove them ... but when I'm working in existing applications.

For new applications is great that directories are created for you.

So I guess this is tricky.

Well it's OK to generate empty dirs, which is what the .gitignore currently is for.

But then after the file can be removed, while remaining the empty dir until the user commits it.

I agree. Maybe Symfony Flex could check if there are files in that directory already and then don't sync the .gitignore file for that directory?

B.t.w. in my company we use .gitkeep files to keep empty directories in Git. As a .gitignore file suggest the intention that the file has been put there with the purpose of ignoring certain files in the directory. With .gitkeep it is clear that it's purpose is to _keep_ the empty dir in Git. I do know it is not documented and it is not officially supported by Git, but it is an industry standard. (.gitignore is documented, but not for this purpose)

.gitignore is the industry standard. Check https://stackoverflow.com/questions/7229885/what-are-the-differences-between-gitignore-and-gitkeep for the background behind this claim.

@ro0NL PR welcome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javiereguiluz picture javiereguiluz  Â·  6Comments

fabpot picture fabpot  Â·  7Comments

kolibri picture kolibri  Â·  3Comments

javiereguiluz picture javiereguiluz  Â·  5Comments

weaverryan picture weaverryan  Â·  3Comments