Quantcast
Channel: Corrado's Blog 2.0
Viewing all articles
Browse latest Browse all 46

Learning Git with Visual Studio #8

$
0
0

It’s inevitable, you or someone in your team make some changes and code doesn’t work as it should anymore and so is important to understand what has changed, when it has changed and maybe even who and why he made that change.
Since the team uses Git is easy to compare different commits and visually see what differs between them.
Let’s go to git history, let’s select the commits we want to compare and select Compare Commits…

image

Inside Team Explorer tab we’ll see a detail of what has changed including all files

image

Double clicking any of listed files I can see what has changes inside that file

image

Same result can be reached by selecting the file in solution explorer, right click, View History and then Compare

image

Of course is not necessary to Commit a file in order to compare it, you can compare any modified or staged file by just right clicking it and select Compare with unmodified menu

image

Of course comparison can be done between different branches as well

image

If you want to in deeper detail about changes related to a file, we can use the Blame (annotate) option, let suppose we did some changes to Program.cs  and we want to know who (and what) has changed that file, just select the file and select the menu Blame (Annotate)

image

A new window will open containing the content of the file and on the left the list of commits that changed those lines

image

To know what had been changed in a commit just click the commit, the changes tab inside Team Explorer will open, right click the file and select Compare with previous menu.

image

No rocket science here, but a feature used quite often during normal dev life Smile


Viewing all articles
Browse latest Browse all 46

Trending Articles