问题
I have this
d0 -----
| \
| ------ f1
d1 |
| |
| |
d2------ f2
| \ |
| \ |
d3 \ |
| --- merge
| |
d4 --- f3
\ |
\ |
\ |
----- merge
|
|
f4
No, really. I actually made a repo like this. Note that I had to fix a merge conflict between d3 and f3.
C:\dev\git-test> git tree
* 9a169c2 (HEAD, feature) f4
* 1396e5c fixed master -> feature merge conflict
|\
| * 7ececbd (MASTER) d4
| * a2be7eb d3
* | 8c11a80 f3
* | caa9068 Merge branch 'master' into feature
|\ \
| |/
| * 576ac31 d2
| * fe78786 d1
* | 4e7ac84 f2
* | f3e13dc f1
|/
* 15a0d51 d0
I'm regularly merging master
into feature
because feature
is shared, so periodically rebasing feature
onto master
would be a nightmare. Each developer has a private copy of feature
which they keep rebased onto origin/feature
. To keep master
and feature
from diverging I'm stitching in master
on a regular basis. (Please let me know if there's a better way. I couldn't discern the difference between 1 and 3 in this post.)
Now I want to perform some commands and cause this to happen:
d0
|
d1
|
d2
|
d3
|
d4
\
f1`
|
f2`
|
f3`
|
f4` <- master
This seemed likely:
git checkout feature
git rebase master
The problem is that the merge resolution for that d3/f3 conflict is not remembered. I do have rerere
turned on. I think the reason for this is that in the first merge we are playing d3 onto f3, and in the rebase we are playing f3 onto d3. How do you handle this problem?
来源:https://stackoverflow.com/questions/21613406/backmerging-a-stitched-up-feature-branch-with-clean-history