I have been reading several posts on this forum, progit, Youtube and some random blogs for rebase.
The most general form to conclude this subject is:
- A - B - C Master
\ D - E Topic
and I perform:
git checkout Topic
git rebase Master
Ideally, it would be:
- A - B - C - D' - E' Master, Topic
But the 2 concerns are:
- Is D' = D, E' = E?
- What is git rebase conflict?
Regarding to the first concern and this post,
- Rebase do merging on D and E, and above all, with complicated input.
For example, when it goes to D, according to the post and if I am correct
- HEAD detached to C
- Git compares between changes from A to D and changes from A to C
- After merging, git compares between D', D and E
And this confuses me the most. Why does merge involving more than 2 commits? Also, how does a conflict appear?
EDIT:
Ran some commands, please see the following:
git init
Created a Random.txt Content: Master 1
git add Random.txt
git commit -m "Master 1"
Create new branch
git checkout -b rebase_conflict
Alter Random.txt Content: 1
git add Random.txt
git commit -m "Conflict 1"
Alter Random. txt Content: 2
git add Random.txt
git commit -m "Conflict 1"
Switch to master
git checkout master
Alter Random.txt content: Master 2
git add Random.txt
git commit -m "Master 2"
Switch branch and rebase
git checkout rebase_conflict
git rebase master
Get conflict error Alter Random.txt Content: 1
git add Random.txt
git rebase --continue
At this point, I expect another rebase conflict, because according to the logic
-- Master 1 -- Master 2
\ -- Conflict 1 -- Conflict 2
After first rebase
-- Master 1 -- Master 2 -- Conflict 1'
\ -- Conflict 1 -- Conflict 2
At this stage I am expecting a new commit on top of Conflict 1'. Isn't there a merge conflict between Conflict 2 and Conflict 1'?
Because Conflict 1' Random.txt content: 1, whereas
Conflict 2 Random.txt content: 2
They change the same line, isn't it?