harinsamaranayake
harinsamaranayake

Reputation: 961

How to compare the current branch with another branch in Visual Studio 2019?

In Visual Studio lets assume the following scenario:

  1. Create a branch from the master.
  2. Make some changes.
  3. Commit.
  4. Again make some changes.
  5. Commit.

When we make a commit there are no changes displayed under the Team Explorer > Changes. If we didn't do the step 5 the Changes tab will display the current changes compared with the previous commit. I need to know how to compare current state of the branch(committed + uncommitted) with the original code(master branch).

Upvotes: 4

Views: 7120

Answers (2)

J.J
J.J

Reputation: 1001

For Visual Studio 2019 (as asked)

  • Open window Git Changes
  • Click on Additional Operations

Git Changes Window

  • Click Manage Branches

enter image description here

  • Select the two commits/branches you want to compare (with ctrl+click)

enter image description here

  • Right click on one of the selected commits and choose Compare Commits

enter image description here

  • Now at the bottom right you should have a list of the files that have been changed and you can click on them to see the differences between them.

enter image description here

Upvotes: 2

cc sdk
cc sdk

Reputation: 21

If you are using the Microsoft DevOps as your remote repository. DevOps has a way to compare branches. Under the "Repos/Branches" menus.

Example Heading:

Branch compare Comparing "RevampTasks" to "Development"

Upvotes: 2

Related Questions