Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does git branch for 4 different environment

Tags:

git

github

Currently, we have four different IT environments, dev for the developer, and test for the tester to test the code. UAT is a production like environment, which is for some end-user to use the product before going to production. Production is production.

So I have read some article online about Git source control, but it looks like git only has development branch (for developer) and master branch(for production), feature branch for adding a feature, the release branch is for the tester to test it.

Therefore, I was wondering if it is necessary to have a separate UAT and test branch? So the end-user and tester can test the code separately. If so how can I set up those two branch in git ?

like image 288
Zhe Wu Avatar asked Jan 01 '23 17:01

Zhe Wu


1 Answers

Git branches are completely separate to the concept of multiple code environments, and don't have to map out one-to-one. Git itself should be restricted to develop, feature, bugfix, hotfix, release and master. This is illustrated in Git Flow:

Git Flow

Typically develop is deployed to the development environment, release is deployed to the test environment and master is deployed to the production environment. However, note that this is not a required deployment strategy. If you have additional environments such as UAT, you ultimately simply want to test what the end-user will see. The code in the latest release should be identical to that of master, so it shouldn't matter which of these two you deploy to the UAT environment; it comes down to personal preference. Personally, I would opt for release, due to master typically being considered the "last known good point". Your end-users may find some bugs that your own testers may not!

Having said this, it's also worth noting that there is a current push to "shift left" in the DevOps circles, where the entire testing cycle takes place on the feature branch itself, with develop being considered "shippable code". In this scenario, develop could make its way right through to production, so (in theory), all environments would point against develop. However, I would still recommend following Git Flow personally.

like image 79
Obsidian Age Avatar answered Jan 05 '23 03:01

Obsidian Age