If your using composer or another package management system, it’s great isn’t it? But it comes with a lot of junk in the form of hidden .git repos that keep a record of every change the project has committed. You don’t want to send all that over the wire every time you deploy to staging or production. This is especially important if your using your own internal packages making it ready for anyone to come steal, accessing the full source code of your project.
Either way this shell command will remove them. I put it in a chef cookbook, you can use it however you want.
find . | grep .git | xargs rm -rf