New to Git - production and staging environment

I am new to Git and I would like to implement this in my workflow. I have a website with two directories:

  • public_html (production)
  • staging

I would like to make changes to the process and move them to public_html as soon as they are well tested. At the moment I am using GitHub in between. So from the step I'm using:

git push -u origin master

      

The stage will then be pushed to a private GitHub repo

From public_html (production folder) I will call:

git pull origin master

      

Is this the best workflow for me? 99% of the time I work solo, by the way.

+3


source to share


1 answer


Typically version control and release packaging are two different concepts. When you use git for version control, all release-related files are kept track of, it might be internal project documents, source code for some libraries, development tool support, secret key files, etc. which are required to build the version, but should not be deployed in a production environment.

In your case, it sounds like you are deploying everything to your production server. The best workflow is that you should have a simple package release program, which can be as simple as a script / batch file, to copy only the files you need and possibly create a single .zip file. The script should also be tracked in git.



When you're done testing, you should commit everything and flag the version. Then use a packaging script to create that zip file and simply unzip to your public_html for release

+1


source







All Articles