Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing git branches in Visual Studio 2017?

Is there any way to compare two git branches in Visual Studio 2017? I just want to see what files have been changed on my feature branch compared to the master branch.

I'm aware that I can go to Team Explorer > Branches > Right click and View History > and then double click a specific commit to see it's changes. However, I'm not aware of a way to the sum of changes for that branch.

like image 328
Ethan Fischer Avatar asked Mar 14 '18 16:03

Ethan Fischer


People also ask

How do I see different branches in Visual Studio code?

You can create and checkout branches directly within VS code through the Git: Create Branch and Git: Checkout to commands in the Command Palette (Ctrl+Shift+P). If you run Git: Checkout to, you will see a dropdown list containing all of the branches or tags in the current repository.


1 Answers

Go to Team Explorer > Branches > Right click your branch > View History > click the latest commit > ctrl + click the latest commit from master > right click > Compare Commits

edit: this only shows you the diff between commits. There's still no way that I'm aware of to compare branches via the VS interface.

However, if you want to see all the changes you made in a feature branch before submitting a PR, using command line you can do this:

checkout master

merge <branch-name> --no-commit --no-ff

and then look at Changes in Team Explorer to see all the changes you made in a branch before submitting a PR.

like image 120
Ethan Fischer Avatar answered Oct 05 '22 17:10

Ethan Fischer