You have to rebase --interactive your design branch on top of production, where:
- You can change the order of your commits, starting with the ones you need in production.
- you can combine production with the last design fixation you want to enable (fast forward).
-x - x - x1 - x - x2 (design)
\
p - p (production)
With x1 and x2, which must be included in the production:
git checkout design git rebase --interactive production -x \ p--p (production) \ x1'-x2'--x'--x' (design)
Then:
git checkout production git merge x2' -x \ p--p--x1'--x2' (production) \ x'--x' (design)
This allows:
- to check the current project, undertakes to make compromises (durung the rebase)
- reorder
- include first in production
- allows subsequent mergers from design to production to be fast-acting.
Lakshman Prasad adds:
I push the changes the most at the end of the day. So it doesnβt help much. How your answer will change for the pressed main branch
I would do the same, but with a private branch created only for the operation:
git checkout master git checkout -b master-private
-x - x - x1 - x - x2 (master, master-private)
\
p - p (production)
then rebase, this time with a private branch (i.e. a branch that you will never push).
git rebase --interactive production -x--x--x1--x--x2 (master) \ p--p (production) \ x1'-x2'--x'--x' (master-private)
Then:
git checkout production git merge x2' -x--x--x1--x--x2 (master) \ p--p--x1'--x2' (production) \ x'--x' (master-private)
master will not benefit from reordering the commit (in a more logical order), but at least you can press master whenever you want.
And production may still include exactly what it needs.
If the subsequent master commit has the same problem (some should be included in production , others later), I would:
- delete
master-private (we donβt really care about those x ', a copy of x is committed from the master) - make the
master-private branch on top of the master - repeat the
rebase --interactive operation with conflict resolution tactics (except for the first commits of this master-private branch, since they must be integrated into the production branch)
-x - x - x1 - x - x2 - x - x3 - x (master)
\
p - p - x1 '- x2' - x3 '(production)
| \
| x '' - x '' (master-private)
\
x '.. x' (old x 'from the first master-private)
VonC Jun 11 '10 at 11:52 2010-06-11 11:52
source share