We have currently just master branch. Our current workflow involves implementing the features locally, committing to the repository and updating the test server, letting the client know about it and if he approves the changes we also update the production.
The thing is that now we use SVN and we update manually the specific folders and files that we have changed because otherwise we might get unwanted changes to production. With Git as our near-future repo that we use for one project already, what kind of Git workflow/branching would suit our need? The Git workflow needs to work well for this scenario:
- Do your work locally.
- Update test server and let client know.
- If client approved the changes, update the production as well.
Ideally we would want it to be possible to update the production to a specific tag all files and folders at once. It’s possible that test and production have several different changes from many developers and some of them need to be moved to production some not.
Initially I thought of having 3 branches master for production stable releases, test for the test server (to be merged to from dev) and dev where we code. I’m not sure if this fits well.
In my opinion, you wouldn’t necessarily need branches for each server – this can create (depending on your ignores and some other factors) some issues when cascading changes up and down. Instead, your various servers can just have a branch checked out and changes pulled to it. The server having a complete copy of the repository is very, very useful.
Our ecosystem initially included branches for every server, production, staging, and development – syncing changes between the branches sometimes created merge issues that were very frustrating. We currently have all of the servers with the production branch checked out, and we’ve saved ourselves quite a few headaches. We check everything there before actually
pulling on the production server – you can also switch branches if needed to test more drastic coding changes. There’s a lot of flexibility there.My suggestion would be to evaluate your workflow and see if you can leverage hooks to automate the process of updating your test/staging servers. We do this wonderfully with gitolite. Otherwise, your workflow is easily achieved, and you can put some polish on the concept to automate it further.