Visual Studio: view full git commit history (including renaming)

I am using Visual Studio 2015 and the Microsoft Git client. I am facing some issues with viewing history and annotations using the toolkit, because Visual Studio does not seem to handle renaming files when viewing Git history. Is there a good way around this?

BTW: I tried using the Show Full Story toolbar in the story viewer, but it didnโ€™t actually show the renamed story

Here is what I did to check:

  • In Visual Studio, I right-clicked the file and selected View History. (he showed only 4 commits)
  • In the history window, I clicked the "Show Full History" button - all the same 4 commits.
  • On the Git command line, I ran Git log --follow theFile.cs (it generated 13 commits)
  • In the Atlassian Source Tree, I pulled out the log for the file, and I checked the "Follow Renamed Files" option. He pulled the same 13 commits as on the command line.

I really want Visual Studio to have an option that matches. Is it possible?

+8
git visual-studio visual-studio-2015
source share
1 answer

Visual Studio runs a story between two commits to determine if a file has been renamed. Here I renamed one file from its original name to renamed and made changes to the contents at the same time:

File history

However, Git does not track changes between the two commits - instead, it compares the snapshots of the commits to determine how the files were changed. Thus, there is no information about renaming in the repository history. Instead, this is calculated by comparing the file in the original commit with the file in the subsequent commit. If they are similar enough, then Git will consider it a renaming.

Since this is a heuristic, this does not guarantee that this will be considered a renaming. However, Visual Studio and Git for Windows need to harmonize these things, generally speaking. I would be curious why you are reporting this as a rename, and the other is not. Two possibilities are possible:

  • This file is very close to the edge of similarity - let's say Git decided that the two revisions are 61% similar to each other and thus are renamed, while Visual Studio decided that these two versions are only 59% similar, and therefore, are not a renaming.
  • There is some kind of error when Visual Studio incorrectly calculates the similarity. If I were to guess, I would suggest that the problem with a space or line ends, because it is always a problem in Git.

If you can share two versions of this file, opening a connection error or sending an email will directly help me to continue the research.

+5
source share

All Articles