<img width="722" alt="screen shot 2017-10-16 at 12 49 12 am" src="https://user-images.githubusercontent.com/16771854/31600577-daa587e2-b20b-11e7-8ba1-df652aaf4cb1.png">
<img width="753" alt="screen shot 2017-10-16 at 12 48 31 am" src="https://user-images.githubusercontent.com/16771854/31600543-c113f408-b20b-11e7-9ef3-d67138412244.png">
* create a new commit on `Feature3` branch
For example, create and edit test file `test15-1`
<img width="820" alt="screen shot 2017-10-16 at 12 50 54 am" src="https://user-images.githubusercontent.com/16771854/31600646-16bb685a-b20c-11e7-8d41-8d7039dd823d.png">
<img width="756" alt="screen shot 2017-10-16 at 12 50 23 am" src="https://user-images.githubusercontent.com/16771854/31600625-05f8b3a6-b20c-11e7-9550-8f6e5fd6decf.png">
Now, preparation work is done, and the project log becomes (diverge appears):
<img width="666" alt="screen shot 2017-10-16 at 12 51 39 am" src="https://user-images.githubusercontent.com/16771854/31600686-358ae134-b20c-11e7-9e3a-dcb5f779bae7.png">
### Step1: Rebase `Feature3` branch
git checkout Feature3
git rebase Feature2
<img width="554" alt="screen shot 2017-10-16 at 12 52 56 am" src="https://user-images.githubusercontent.com/16771854/31600733-62557cf6-b20c-11e7-8e67-2c00e6187991.png">
<img width="753" alt="screen shot 2017-10-16 at 12 53 36 am" src="https://user-images.githubusercontent.com/16771854/31600770-7a1c8122-b20c-11e7-8440-48fc6d090ded.png">
<img width="1000" alt="screen shot 2017-10-16 at 12 54 11 am" src="https://user-images.githubusercontent.com/16771854/31600790-8c30bd92-b20c-11e7-8f4f-c0b3648877f3.png">
`Feature3` branch is moved, `rebase` is done successfully. However, no commit about `rebase` is created.
### Step2: Merge `Feature3` back to `Feature2`
git checkout Feature2
git merge Feature3
<img width="628" alt="screen shot 2017-10-16 at 12 55 48 am" src="https://user-images.githubusercontent.com/16771854/31600849-c7f92bca-b20c-11e7-8a02-9a832bb454d5.png">
<img width="1002" alt="screen shot 2017-10-16 at 12 57 04 am" src="https://user-images.githubusercontent.com/16771854/31600902-f53528f0-b20c-11e7-8d2b-132af8766a60.png">
A fast-forward merge is done, no merge commit is created.
### Step3: check `git log` and `git reflog`
* `Feature2` branch:
<img width="550" alt="screen shot 2017-10-16 at 12 58 46 am" src="https://user-images.githubusercontent.com/16771854/31601037-638e2ffe-b20d-11e7-871a-8d7104cb6be5.png">
<img width="550" alt="screen shot 2017-10-16 at 12 58 46 am" src="https://user-images.githubusercontent.com/16771854/31601084-7bb76ec4-b20d-11e7-839c-4a80e54fba2e.png">
**As we can see,**
* the `rebase` process is done with no extra visual commit
* no record in `git log`
* only visible in `git reflog`
* fast-forward merging, thus no merge commit is created
* no record in `git log`
* only visible in `git reflog`
Feature3 branch derived from Feature2, rebase Feature3 before merging
Scenario abstract
Feature2
andFeature3
),Feature3
was derived fromFeature2
;Feature3
branch was created,Feature3
createdtest 15-1
, commitFeature2
re-edittest15
, commitFeature3
back toFeature2
Feature3
branch --git rebase Feature2
Results:
git log
git reflog
git log
git reflog
Data could be explored:
git log
git reflog
Detailed steps:
Step0: prep
test15
onFeature2
branchsync
Feature2
andFeature3
create a new commit on
Feature2
branch For example, re-edit test filetest15
edit test15
git add test15 git commit -m "Feature2: edit the file test15"
git checkout Feature3 touch test15-1
edit test15-1
git add test15-1 git commit -m "Feature3: created, edited the file test15-1"
git checkout Feature3 git rebase Feature2
git checkout Feature2 git merge Feature3
git checkout Feature2 git branch git log git reflog
git checkout Feature3 git branch git log git reflog