Published 1 year ago by xtremer360
I'm building an web app that will eventually be a pay per month use by companies so my code base I would like to keep private for right now. So far I have done my initial commit to my local repository master branch and created a development branch. Then I switched to the dev branch and did two changes with deleting the welcome view as well as changing the .env.example file to .env. as my second commit.
Next I started getting into the meat of my project and making 15 additional commits while still being on the development branch. However I had a conversation with a fellow Laravel developer that says even in the development branch I should include the .env.example file just so if I ever decide to have this repository be public then those developers will know what environment variables they'll need to include.
Is this really what I should do?
I ask this because in the video lessons I've seen from @JeffreyWay he immediately changes it to the .env file name. So I was seeking additional thoughts?
@xtremer360 You should keep the .env.example in your repository, and never include your .env file populated with sensitive information such as database credentials and API keys.
The reason being, the .env.example file acts as a “blueprint” for your .env file so any developer who checks the repository out—no matter what branch—should be able to create an .env specific to their environment to be able to work with your project.
Here's how to search for and completely remove sensitive information (like your .env file) from your repo: https://help.github.com/articles/remove-sensitive-data/
I've used the BFG Repo-Cleaner that's mentioned at the bottom of the article. It works like magic.
@xtremer360: I'm sure there's a way to do that, but why? Do you expect yourself or others to specifically checkout the commits between when you deleted it and your current commit? Have you tagged commits in that time period? Made releases? If not, there's no reason to rewrite any history. Simply add it back in a new commit and merge it into all of your working branches. Good to go. =)