Reputation: 633
Our team is stupid and pushes all develop branches into master. Master reflects all environments, dev/qa/prod. We need to perform a hotfix in prod and not bring along all the other changes.
So I want to checkout the production sha, add some changes, and push to master and run it all the way up to production. Problem is I'm getting merge conflicts and I'm behind master.
git checkout <<sha>> -b update-prod
// add my changes
git add .
git commit
git push
Definitely missing a step but I feel like this is totally doable and I'm just not understanding how to do this from the documentation I'm finding.
Upvotes: 1
Views: 57
Reputation: 1324887
No I'm not. I want to get the change in prod and then add back the changes and put them in dev/qa
Then create your hotfix
branch from prod, and merge it back to prod
directly, as well as master
.
But consider also gitworkflow
(one word), in which that kind of merge is a natural occurrence: you would not merge dev
to qa
, qa
to prod
: you would only merge feature branches or hotfix branches directly to the relevant environment (dev
/qa
/prod
) branches.
See more at rocketraman/gitworkflow
Upvotes: 1