master
|
|
+-------<----+----->------+
| | |
| | |
| | |
branch1 | branch2
| | |
| | |
+----->------| |
| |
| |
X-conflict-<-+
Rebase conflicts Assume we start like this where A, B, C etc represents staged changes.
master
section1 |
C-------<----A
| | section2
D B +----->----F
| |
E G
master
|
A
|
B
| rebase-back-to-master
C------->----C
| |
F D
|
E
if rebase rebase-back-to-master into master
we get
master
|
A
|
B
| rebase-back-to-master
C------->----C
| |
D D
| |
E E
|
F
if just plain merge we get
master
|
A
|
B
| rebase-back-to-master
C------>-----C
| |
F D
| |
G------<-----E
where G is like a knot that ties up both branches
remedy is perform 1. pull and rebase at rebase-back-to-master and then 2. resolve conflict at rebase-back-to-master
master
|
A
|
B
| rebase-back-to-master
C------->----C
| |
F F'
|
D
|
E
After we merge section1 back to master
master
section1 |
C-------<----A
| | section2
D B +----->----F
| | |
E D' G
|
E'
Note!!
When you perform a git rebase operation, you're typically moving commits around.
So if section1 branch and section2 branch changed same files with respect to the same lines, github pull request will stop you to merge section2 into master branch with rebase since there are conflicts.