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] #6 (aka 5): merge Feature1 branch to Master branch (only Feature1 has new commits) #6

Open dorawyy opened 7 years ago

dorawyy commented 7 years ago

Cloned the repo, work on two branches

Scenario abstraction

Results:

Data could be explored:

git_merge_conflict

Detailed steps

step0: start point of the test case:

screen shot 2017-10-13 at 2 33 07 pm screen shot 2017-10-13 at 2 35 34 pm screen shot 2017-10-13 at 2 37 52 pm

Creating branch and checking out Feature1, it also has the file test5, the version is the same as master branch. screen shot 2017-10-13 at 2 39 16 pm screen shot 2017-10-13 at 2 39 25 pm

Startpoint preparation finished.

The master branch head and Feature1 branch point to the same commit, and the project log looks like: screen shot 2017-10-13 at 2 42 16 pm

Step1: cloned the repo ( already did in testcase #1 )

git clone https://github.com/dorawyy/git-merge-conflicts-test.git git-merge-conflicts-test-1

To make it short, we call them:

Step2: Feature1 branch: edited file test5, committed

screen shot 2017-10-13 at 2 46 51 pm

## making sure working on Feature1 branch
git branch 
git add test5
git commit -m "Feature1: edited the file test5"

screen shot 2017-10-13 at 2 48 57 pm

The project history in EGit becomes like (Feature1's head moved forward, 1 commit ahead master ): screen shot 2017-10-13 at 2 49 26 pm

Step3: master branch: no change

do nothing in this step

Step4: checking out master branch, merge Feature1 branch back

# make sure on master branch
git checkout master
git branch
# merge
git merge Feature1

As we can see, before merging, Feature1 branch is 1 commit ahead master branch: screen shot 2017-10-13 at 3 32 23 pm

When the developer merge, it is a fast-forward merging, and the master branch head move 1 commit forward, pointing to the same commit as Feature1 branch: screen shot 2017-10-13 at 3 34 49 pm

Step5: Looking into details about the commits happened during the whole test

screen shot 2017-10-13 at 3 40 22 pm

screen shot 2017-10-13 at 3 40 29 pm

Step6: history in github before vs. after git push origin master

For now, the developer hasn't pushed the test5 edit commit to remote repo, the latest commit on Github is:

--> master branch: screen shot 2017-10-13 at 3 45 48 pm

--> Feature1 branch: ( no Feature1 branch on remote repo yet because the developer hasn't set up it to be remote-tracking one ) screen shot 2017-10-13 at 3 47 59 pm

Now, if the developer git push commits to master branch to the remote repo: screen shot 2017-10-13 at 3 51 33 pm The two commits will show up on github - master branch screen shot 2017-10-13 at 3 52 03 pm

However, the branch Feature1 is still not on github screen shot 2017-10-13 at 3 53 03 pm

Step7: setup remote-tracking, git push origin Feature1

git checkout Feature1
git branch

screen shot 2017-10-13 at 3 56 00 pm

git branch -a 

screen shot 2017-10-13 at 3 58 16 pm

As we can see, there is no remote-tracking branch of Feature1

# git checkout Feature1
git push origin Feature1
git branch -a

screen shot 2017-10-13 at 3 59 55 pm

screen shot 2017-10-13 at 4 00 33 pm

As we can see now, there is a Feature1 branch on github screen shot 2017-10-13 at 4 01 32 pm

When looking into changes of Feature1 branch: screen shot 2017-10-13 at 4 01 40 pm

it has all the new commits in this test case, also all history commits of its parent branch -- master branch.

Conclusion: no history/data recorded for this case, nothing to exploit