Source Control (2-2), TFS - Merge

This is a series of articles related to Source Control or Version Control issues, from a stand-alone app, such as MS SourceSafe, to a Server app, such as MS TFS (Team Foundation Server), to web services such as GitHub, AWS, and MS Azure DevOps. We have tried to categorize this series of articles as Source Control or Version Control, but this site does not have these categories. So, we put the articles in the DevOps category, as explained in the Wiki:

DevOps is a set of practices that combines software development (Dev) and IT operations (Ops). It aims to shorten the systems development life cycle and provide continuous delivery with high software quality.[1] DevOps is complementary with Agile software development; several DevOps aspects came from the Agile methodology.

The structure of this article series will cover:

  • Stand Alone App:
    • MS Source Safe
  • Server App
    • MS TFS (Team Foundation Server)
  • Online (Cloud) Centralized Service:
    • MS Azure: DevOps
      • Boards
      • Repos
      • Pipelines
      • Test Plans
      • Artifacts
    • GitHub
    • AWS GitHub Enterprise
  • Distributed App:
    • Git

Because these are huge topics, I will not go step by step. Instead, each section will be relatively independent and will become a reading unit.

Introduction

We will discuss Merge for TFS in this article. We assume that we do not consider complex cases such as handling conflict, or labeling. We just introduce a typical protocol we used in our daily work. Note, every company has a different policy, so the requirements might not be the same. This discussion will cover the basic procedure.

  • Introduction
  • Preparation for Merge: Get Latest Versions for both Main and Local
  • Merge from Main to Local
  • Merge from Local to Main

Preparation for Merge: Get Latest Versions for both Main and Local

Get the latest version from the main branch:

Get the latest version from the Dev Branch:

Merge from Main to Local

From How to: Merge Branches | Microsoft Docs, we have:

We will demo the process with photos, and give more details.

Before merge, the Pending Changes in Team Explorer is empty:

Choose Merge from Main to open the Source Control Merge Wizard:

From the Source Control Merge Wizard, choose local branch:

Go to the local branch:

Latest version

Click Finish to Merge:

Finish. Then go to Pending Changes in Team Explorer. The checked in parts are here for pending for local, instead of saving to Local Branch directly.

Check and confirm each pending change by comparing with the latest version:

If everything is correct, then Check in with Comment: Merge from Main,

Yes, finished. Now the Pending Changes will be empty again:

Merge from Local to Main

This process is opposite. From How to: Merge Branches | Microsoft Docs, we have:

The following is the detailed process with photos.

Before merge, the Pending Changes in Team Explorer is empty:

Choose Merge from Local to open the Source Control Merge Wizard:

In the Source Control Merge Wizard, the Main branch is chosen automatically:

Choose the latest version:

Check Pending Changes/Included Changes. Your changed files should be there if everything is correct. Then, Check in with Comment: Merge from Local (GH):

Now the whole process is complete. You have successfully merged your local changes into Main.

Reference


Similar Articles