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…
Inside Team Explorer tab we’ll see a detail of what has changed including all files
Double clicking any of listed files I can see what has changes inside that file
Same result can be reached by selecting the file in solution explorer, right click, View History and then Compare
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
Of course comparison can be done between different branches as well
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)
A new window will open containing the content of the file and on the left the list of commits that changed those lines
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.
No rocket science here, but a feature used quite often during normal dev life