dorawyy / git-merge-conflicts-test

This repo is for testing of git functionalities / different merging conflict scenarios, and CI tools usage
2 stars 4 forks source link

[testcase notes] #13: rebase branch Feature2 on Feature3 (only commit on Feature3) #15

Open dorawyy opened 7 years ago

dorawyy commented 7 years ago

Feature3 branch derived from Feature2, rebase Feature3 before merging

Scenario abstract

wechatimg256

Results:

Data could be explored:

Detailed steps:

Step0: prep

git checkout Feature2
touch test13

# edit test13

git add test13
git commit -m "testcase13: startpoint (create file test13)"
screen shot 2017-10-16 at 12 00 42 am screen shot 2017-10-16 at 12 00 09 am screen shot 2017-10-16 at 12 01 14 am

edit test13

git add test13 git commit -m "Feature3: edit the file test13"

<img width="720" alt="screen shot 2017-10-16 at 12 02 58 am" src="https://user-images.githubusercontent.com/16771854/31599004-66c96c2c-b205-11e7-8fd5-5994f8460810.png">
<img width="764" alt="screen shot 2017-10-16 at 12 02 30 am" src="https://user-images.githubusercontent.com/16771854/31598980-5358219c-b205-11e7-9e60-c12756972e5c.png">

Now, preparation work is done, and the project log becomes:
<img width="1000" alt="screen shot 2017-10-16 at 12 03 24 am" src="https://user-images.githubusercontent.com/16771854/31599022-76413720-b205-11e7-9812-06ca98b02520.png">

### Step1: Rebase `Feature3` branch

git checkout Feature3 git rebase Feature2

<img width="583" alt="screen shot 2017-10-16 at 12 04 57 am" src="https://user-images.githubusercontent.com/16771854/31599076-ac7015be-b205-11e7-9e34-b5ea745d4c81.png">
As there is no new commit on `Feature2`, no rebasing happens.

### Step2: Merge `Feature3` back to `Feature2`

git checkout Feature2 git merge Feature3

<img width="588" alt="screen shot 2017-10-16 at 12 06 39 am" src="https://user-images.githubusercontent.com/16771854/31599138-e9131200-b205-11e7-8a36-6f76c9346500.png">
A fast-forward merge is done. And the project history becomes (no extra commit):
<img width="1006" alt="screen shot 2017-10-16 at 12 07 24 am" src="https://user-images.githubusercontent.com/16771854/31599170-02e59f36-b206-11e7-89b0-0d0addeb80c6.png">

### Step3: check `git log` and `git reflog`

git branch git log git reflog


<img width="552" alt="screen shot 2017-10-16 at 12 09 01 am" src="https://user-images.githubusercontent.com/16771854/31599221-4c3290b8-b206-11e7-86d7-bf122067b578.png">
<img width="514" alt="screen shot 2017-10-16 at 12 09 23 am" src="https://user-images.githubusercontent.com/16771854/31599222-4c57de72-b206-11e7-80d2-18e2c9ce570d.png">

As we can see, 
* the `fast-forward` commit record is not seen from `git log`, however, it is noted in `git reflog`
* as no rebasing is done, no record about `rebase` is found.