Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[testcase notes] #15: rebase branch Feature2 on Feature3 (both commits, diff files) #17

Open
dorawyy opened this issue Oct 16, 2017 · 0 comments

Comments

@dorawyy
Copy link
Owner

dorawyy commented Oct 16, 2017

Feature3 branch derived from Feature2, rebase Feature3 before merging

Scenario abstract

  • developer1 worked on two branches (Feature2 and Feature3), Feature3 was derived from Feature2;
  • after Feature3 branch was created,
    • Feature3 created test 15-1, commit
    • Feature2 re-edit test15, commit
  • now developer1 would like to merge Feature3 back to Feature2
  • however the developer would like to rebase Feature3 branch -- git rebase Feature2
  • What would happen?

wechatimg258

rebase_conflict

Results:

  • no conflict (as commits in different files on different branches)
  • fast-forward rebase, no commit created
    • no visible commit in git log
    • however, record in git reflog
  • fast-forward merge
    • no visible commit in git log
    • however, record in git reflog

Data could be explored:

  • no commits in git log
  • only record in local git reflog

Detailed steps:

Step0: prep

  • create and edit test file test15 on Feature2 branch
git checkout Feature2
touch test15

# edit test15

git add test15
git commit -m "testcase15: startpoint (create file test15)"

screen shot 2017-10-16 at 12 46 49 am

screen shot 2017-10-16 at 12 46 05 am

  • sync Feature2 and Feature3
git checkout Feature3
git merge Feature2

screen shot 2017-10-16 at 12 47 21 am

  • create a new commit on Feature2 branch
    For example, re-edit test file test15
git checkout Feature2

# edit test15

git add test15
git commit -m "Feature2: edit the file test15"

screen shot 2017-10-16 at 12 49 12 am

screen shot 2017-10-16 at 12 48 31 am

  • create a new commit on Feature3 branch
    For example, create and edit test file test15-1
git checkout Feature3
touch test15-1

# edit test15-1

git add test15-1
git commit -m "Feature3: created, edited the file test15-1"

screen shot 2017-10-16 at 12 50 54 am

screen shot 2017-10-16 at 12 50 23 am

Now, preparation work is done, and the project log becomes (diverge appears):
screen shot 2017-10-16 at 12 51 39 am

Step1: Rebase Feature3 branch

git checkout Feature3
git rebase Feature2

screen shot 2017-10-16 at 12 52 56 am

screen shot 2017-10-16 at 12 53 36 am

screen shot 2017-10-16 at 12 54 11 am

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

screen shot 2017-10-16 at 12 55 48 am

screen shot 2017-10-16 at 12 57 04 am

A fast-forward merge is done, no merge commit is created.

Step3: check git log and git reflog

  • Feature2 branch:
git checkout Feature2
git branch
git log
git reflog

screen shot 2017-10-16 at 12 57 43 am

screen shot 2017-10-16 at 12 58 46 am

  • Feature3 branch:
git checkout Feature3
git branch
git log
git reflog

screen shot 2017-10-16 at 12 58 46 am

screen shot 2017-10-16 at 12 58 46 am

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant