简体   繁体   中英

Git Dev to Production Workflow

I have two developers working in a local environment and using github. Each developer has their own branch they push and merge into, which then gets pulled and merged into main.

dev1 branch local  --> dev1 branch remote -->
                                               --> main
dev2 branch local  --> dev2 branch remote -->

I'm now looking to introduce a new remote branch for development/qa. My goal here is that I want to connect this new development/qa branch to a live site that fully replicates the production environment and use for qa testing before pulling it into main.

dev1 branch local  --> dev1 branch remote -->
                                               qa/dev branch ----> main
dev2 branch local  --> dev2 branch remote -->

I have a workflow in place that merges main with my production server, so anytime there is a change to main it runs. I want to keep this in place.

dev1 branch local --> dev1 branch remote -->
                                              qa/dev branch --> main -->live/prod
dev2 branch local --> dev2 branch remote -->

The concern I have now is when managing the pull and merge from qa/dev into main. Github has main as the default branch to always pull and merge into, so when one of the remote dev1 or dev2 branches are pulled and merged, Github always sets main as the default. I prefer the default is the qa/dev branch, so there is no mistake made.

Is there a way of accomplishing this while maintaining the existing structure and workflow?

On that production server, you could change the upstream branch for local main to origin/qa/dev

# Connect to production server
cd /path/to/repository
git switch main
git fetch
git branch -u origin/qa/dev

That way, a git pull in that repository (on prod server) would fetch and merge origin/qa/dev to main .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM