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]#28: Pull Request, new conflicts coming with new commits #73

Open dorawyy opened 6 years ago

dorawyy commented 6 years ago

Scenario:

Julia's note:

wechatimg289

Scratch of the test case:

wechatimg318 wechatimg319 wechatimg320

Applied branches: PR1 and PR2

Start point

PR1 and PR2 in sync. screen shot 2017-11-13 at 12 57 28 pm

dorawyy commented 6 years ago

Steps:

Step1: commit on PR2

git checkout PR2
vim test28_pull_request
git add test28_pull_request
git commit -m "PR2: create file test28_pull_request: a=1,b=1,c=1"
git push origin PR2

screen shot 2017-11-13 at 1 00 17 pm screen shot 2017-11-13 at 1 03 13 pm

Step2: Create a pull request from PR2(head branch) to PR1(base branch)

Only 1 commit, able to merge screen shot 2017-11-13 at 1 04 02 pm screen shot 2017-11-13 at 1 05 31 pm

Step3: Commit on PR1, conflict

git checkout PR1
vim test28_pull_request 
git add test28_pull_request 
git commit -m "PR1:created file test28_pull_request  a=0,b=1,c=1"
git push origin PR1

screen shot 2017-11-13 at 1 07 21 pm screen shot 2017-11-13 at 1 08 16 pm

3.1 Now, the status of Pull Request becomes:

screen shot 2017-11-13 at 1 08 56 pm

3.2 Resolve the conflict

screen shot 2017-11-13 at 1 09 37 pm screen shot 2017-11-13 at 1 10 09 pm

3.3 A merge commit is created on PR2(head branch), also included into the pull request

screen shot 2017-11-13 at 1 10 50 pm

3.4 After resolving the conflict, the pull request is eligible for merging again

Step4: New commit on PR1(base branch), new conflict

git checkout PR1
vim test28_pull_request
git add test28_pull_request
git commit -m "PR1:edited test28_pull_request; 'a=1,', 'b=2,', 'c=1'"
git push origin PR1

screen shot 2017-11-13 at 1 20 40 pm

4.1 Now, new conflict appeared in the pull request due to the commit

screen shot 2017-11-13 at 1 21 23 pm

4.2 Resolve the new conflict

screen shot 2017-11-13 at 1 22 42 pm

4.3 Take the version of PR1 branch

screen shot 2017-11-13 at 1 23 08 pm

4.4 The conflict is resolved, and a merge commit is created on PR2(head branch)

screen shot 2017-11-13 at 1 24 20 pm

Step5: New commit on both PR1' andPR2`(head branch), new conflict

5.1 PR2: remove file test28_pull_request

git checkout PR2
git pull origin PR2
rm test28_pull_request
git add test28_pull_request
git commit -m "PR2: remove file test28_pull_request"
git push origin PR2

5.2 Now, PR2 history becomes:

screen shot 2017-11-13 at 1 28 30 pm

5.3 The pull request becomes: (no conflict)

screen shot 2017-11-13 at 1 30 53 pm

5.4 PR1: edit file test28_pull_request

git checkout PR1
git pull origin PR1
vim test28_pull_request
git add test28_pull_request
git commit -m "PR1: edited file test28_pull_request: a=3,b=3,z=3"
git push origin PR1

screen shot 2017-11-13 at 1 32 42 pm

5.5 Now, PR1 history becomes:

screen shot 2017-11-13 at 1 33 10 pm

5.6 The pull request becomes: (conflict again)

screen shot 2017-11-13 at 1 33 32 pm

5.7 Resolve the conflict (as this is a delete-modification conflict, cannot resolve online, have to resolve locally)

screen shot 2017-11-13 at 1 33 32 pm

5.8 Resolve the conflict locally

git fetch origin PR1
git fetch origin PR2
git checkout PR2
git merge PR1

Resolve the conflict by removing the file test28_pull_request, then continue merge

git commit 
git push origin PR2

5.9 Now the pull request is eligible for merging again

screen shot 2017-11-13 at 1 40 49 pm

dorawyy commented 6 years ago

Step6: Merge the commit

screen shot 2017-11-13 at 1 43 08 pm

6.1 Choose Option1: Create a merge commit

screen shot 2017-11-13 at 1 44 22 pm screen shot 2017-11-13 at 1 44 39 pm

Step7: Check the history of branches PR1 and PR2

PR1:

screen shot 2017-11-13 at 1 45 37 pm

PR2:

screen shot 2017-11-13 at 1 45 51 pm

Project Tree:

screen shot 2017-11-13 at 1 47 55 pm