We have a repo that contains 'develop' and 'master' branches among others. I have it set up so that I push new commits from my machine to the develop branch. I am currently the only developer but expect to have more in the future. I create a branch on my machine for a new feature, do the development, commit and merge that branch to develop on my machine and then push to develop in the Bit Bucket repo. I want to then push the code to our Staging server.
There should be no development on the Staging server so I don't need a working directory. I just want it simple - push the code to Staging and the changes are merged into the existing code. If some correction to the code in Staging is needed, that will be done in the original feature branch on my machine and committed, merged and and pushed to 'develop' on Bit Bucket and again pushed to Staging.
Likewise, once the code on the Staging server is verified, I need to merge the code into 'Master' from 'develop' and push to the Production server from 'Master' in a similar manner as I'm pushing to Staging. All simple and clean.
A couple questions:
1. How to set up the git instances on Staging and Production servers for this scenario?
2. Production server code is an image from another machine and so it currently has a lot of "changes" both "modified" and "new". How do I convert this over from that to the set-up I'm talking about above?
Note: This is a Laravel 8 framework with PHP 8 on Centos 8 machines.