There is a certain application, it is stored in well, for example BitBucket (Git). This repository has a master branch, into which the code for production is pushed. The code that is in the work, the developers keep in other branches, this also applies to their local repositories, and the repository on BitBucket.
At the same time in various places of the application there are various files of Git itself: .gitignore, .gitattributes, .gitkeep. There is a desire to keep them in the repository, so that developers can share them. At the moment, these files fall into the master branch.
In production, the application is automatically deployed from the repository, in general, it does not matter by what (Composer, Capistrano, Git itself, anything else). The question is: what to do with the Git service files, which from the master repository branch get into production along with all the other files?
Options come to my mind such:
- Exclude these files from the repositories, in principle, let each developer write them locally to himself.
- Leave these files in the repositories in all branches except master, that is, oblige developers to remove them from the master branch after merge / rebuse, before pushing it into the repository on BitBucket.
- Delete these files through a script after deploying to production, the script will run after deployment of one or another tool.
- Leave these files alone, since they are absolutely not needed in production, but still they will not disrupt its work and will not weaken the security of the application, since they are all hidden and the web server will not give them to anyone just like that.
- Your option.
git archive, then.gitwill not get to the server - Mikhail Vaysman