Pushing selected changes to production
I am using Git/Heroku for a work application. Usually, changes will be merged into master then pushed to staging then production. But now I need to push only selected changes (patches) to production. How should I do that?
- Some initial state in master
- Patch 1
- Patch 2
- Patch 3
- Patch 4
- Patch 5
My first thought was to pull from heroku/production. Copy changes here (eg. a subset possibly from patch 2 and 4) and then only push into heroku production. I think this will work, in the short term. But in the future how do I manage such “divergent” changes? Since now master and production is different. When I push from master into production, I guess I will get conflicts? Either that or I will end up overriding changes made on production? How are such changes managed?
- Making it possible to do “git push origin” instead of “git push origin <branch>”, without having to one-time prepare each branch for it
- Commits are not shown properly
- Differences for a certain folder between git branches
- What does hg copy do?
- Is there any decent git repository manager that's downloadable?
- Can I ignore build folder from master branch? - Yeoman Deployments using Git Subtree
One Solution collect form web for “Pushing selected changes to production”
But in the future how do I manage such “divergent” changes?
By creating a dedicated branch “
prod” from which you cherry-pick the right commits you want from master (instead of a global merge)
Since now master and production is different. When I push from master into production, I guess I will get conflicts?
Yes: once you start cherry-picking commits, you shouldn’t merge anymore.
(because of duplicate commits and functional dependencies)
The best reconciliation between those two branches is make
master stable enough for it to replace the the
prod branch (meaning you reset
I do precisely that “double-branch” approach in my compileEverything project.