I have noticed that Symfony Composer automatically creates a .gitignore
file in a new project. However, I can't find anything about a .gitignore
file in Symfony's documentation.
What is the purpose of this file, how does it relate to Symfony, and what should it contain?
the .gitignore file is not specifically for Symfony. This is used for all projects with which git is used for versioning. I recommend this to you https://git-scm.com/docs/gitignore but in general, we use .gitignore this way (With Symfony):
### Ignore what is contained in a directory
### Example the vendor folder
/vendor/
### The change made to a file
### Example the .env environment file
.env
### I created a new directory called "save" and I want to ingon
/path/to/my/save/folder/