Such use of Git is strange. You should have three repositories, with three projects (laravel, wordpress, hello world), branches are used for developing a single project, not a project per branch.
Git is a version control system. This isn't at all what it's meant for.
No .env here since its all in config.php
You shouldn't commit environment values to version control. In Laravel, this means excluding .env with .gitignore (done by default). In WordPress, this means excluding wp-config.php.
You should define environment variables / config in the environment where the app is deployed or developed in.
Yes, it’s technically possible to run Laravel and WordPress from separate Git branches and deploy each branch to a different server or app, and there will be no runtime collisions as long as they’re deployed in isolation with separate databases. However, this is not recommended: Git branches are meant to represent versions of the same application, not entirely different applications. Using branches this way leads to operational problems with CI/CD, releases, rollbacks, and long-term maintainability, even if the code itself never conflicts. The better practice is to use separate repositories for Laravel and WordPress and deploy them independently, even if they live on the same server.