共用方式為


Git for the TFVC User – Workflow Investigations Part 3: Reviewing Changes (With Conflicts)

image_thumb2_thumb … co-authored with Dan Hellem, complementing the Version Control (ex Branching and Merging) Guide.

Continued from Part 1 – Making Changes, we would like to share our notes, NOT guidance, and invite you to give us candid feedback on our proposed walkthroughs that are related to the high-level workflow steps mentioned above:


walkthrough 3.1 – merging changes without a Pull Request

We will walk through a simple workflow so you can understand the mechanics of creating a simple conflicting change and merging the changes. We resume by using the same environment from the previous two walkthroughs, however, there is no dependency on the previous workflows.

Step

Instructions

1 Create topic branch X ꙱ - Done

  • Branch master to Doris/Topic/X.
  • Publish the Doris/Topic/X branch. image

2 Create topic branch Y ꙱ - Done

  • Branch master to Doris/Topic/Y.
  • Publish the Doris/Topic/Y branch. image

3 Change topic X branch and commit.

꙱ - Done

  • Make a change to a file in branch Doris/Topic/X, for example README.md.
  • Commit the change.
  • Synchronize the change (pull+push). image

4 Change topic Y branch and commit.

꙱ - Done

  • Make a different change to the same part of the same file in branch Doris/Topic/Y.
  • Commit the change.
  • Synchronize the change (pull+push).

5 Merge topic X branch with main

꙱ - Done

  • Merge branch Doris/Topic/X with master. image
  • As there is no merge conflict merge will complete automatically.
  • Commit the change.
  • Synchronize the change (pull+push). image

6 Merge topic Y branch with main

꙱ - Done

  • Merge branch Doris/Topic/Y with master. image
  • As expected, the merge completes with conflicts.

7

Resolve the conflicts

꙱ - Done

  1. Select Resolve the conflicts. image
  2. To view the conflicting content changes, select Compare Files. image
  3. We have the option of picking the source or target, or manually fixing the merge conflict. For this happy path, we opt for Take Source.
  4. Select Commit Merge to commit the merge changes.

8 Resolve the conflicts

꙱ - Done

  • Synchronize the change (pull+push).
  • At this point both the developer repo and the centralized repo are synchronized and conflict free. image

walkthrough 3.2 – merging changes with a Pull Request

We will walk through another simple workflow, but using Pull Request, which is the recommended workflow.

Step

Instructions

1 - 4 Create conflict situation ꙱ - Done

  • Perform steps 1 to 4 as per merging changes without a Pull Request as above, but use different topic branches, for example Doris/Topic/A and Doris/Topic/B.
  • Basic steps:
    • ꙱ Branch main –> Doris/Topic/A, then publish.
    • ꙱ Branch main –> Doris/Topic/B, then publish.
    • ꙱ Make, commit and sync change on Doris/Topic/A, then synchronize.
    • ꙱ Make, commit and sync change on Doris/Topic/B, then synchronize.

5 Create Pull Requests for both topic branches

꙱ - Done ꙱ - Done

  • Create a Pull Request for Doris/Topic/A.
  • Create a Pull Request for Doris/Topic/B.
  • At this point we will have two Pull Requests, with no evidence of conflict. image

3 Action Pull Request A

꙱ - Done

  • Review Pull Request for commit on branch Doris/Topic/A. image
  • Approve, merge and complete the Pull Request. image
  • As there was no merge conflict, an automatic merge occurred.

4 Action Pull Request B

꙱ - Done

  • Review Pull Request for commit on branch Doris/Topic/B.
  • Take note that the Ready for Merge has been replaced with a re-evaluate notification, which indicates that the target branch has been updated in the interim. image
  • A re-evaluation highlights the Merge conflicts condition as expected. image
  • Select Manual merge help… for more information. image

5 Manually merge the changes

꙱ - Done

  • Perform the merge as recommended above.
  • Basic steps:
    • Pull changes into master and Doris/Topic/B branches.
    • Merge master into Doris/Topic/B and resolve conflicts.
    • Sync changes.

6 Action Pull Request B again

꙱ - Done

  • Review Pull Request for commit on branch Doris/Topic/B. image
  • Approve, merge and complete the Pull Request. image
  • As there was no merge conflict this time, an automatic occurred. image

… to be continued in PART 4 - Converting a TFVC repository

Thoughts?

Comments

  • Anonymous
    April 14, 2015
    The comment has been removed