I'm using Visual Studio 2015 and the Microsoft Git client. I'm running into some problems with viewing history and annotations with the tooling because Visual Studio doesn't seem to handle file renames when viewing git history. Is there any good way around this?
BTW: I tried using the "Show Full History" toolbutton in the history viewer, but it still didn't actually show history with renames
Here's what I did to test:
What I really want is to have an option in Visual Studio that would match. Is that possible?
Right-click the file in Solution Explorer and select View History. The Visual Studio History view will appear, showing the commits in your repo that updated the file. You can filter the commits to find the exact commit with the file version you want to restore. Double click on the version to open it in Visual Studio.
Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.
Looking up changes for a specific commit If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .
Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.
Visual Studio does follow history between two commits to determine if a file is renamed. Here, I've renamed a single file from its original name to renamed
, and made a change to the contents at the same time:
However, Git does not track changes between two commits - instead, it compares the snapshots of the commits to determine how files have changed. Thus, there is no rename information in the repository's history. Instead, this is calculated by comparing the file in the original commit to the file in the subsequent commit. If they are sufficiently similar, then Git will deem this a rename.
Since this is a heuristic, it's not guaranteed that this will be deemed to be a rename. However, Visual Studio and Git for Windows should agree on these things, generally speaking. I'd be curious why one reports this as a rename and the other does not. There are two possibilities:
If you're able to share the two revisions of this file, opening a connect bug or emailing them to me directly would help investigate further.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With