Right now I have to pull up Pending Changes window, right-click on the file and select Compare->With Latest Version... Is there a faster way to look at my modifications?
-
Faster how? You needn't necessarily go to Pending Changes window - you can also select that compare option from the context menu in an editor window, or from Solution Explorer. But are you looking for a shortcut key? Or tooling from the command line? – Edward Thomson Nov 07 '11 at 15:07
-
I worked with SVN before. In SVN pending changes window, I can just press enter on the selected file and see the mods. That was nice since I don't have to use the mouse at all and I can go through my list of changed files much faster. – dev.e.loper Nov 07 '11 at 15:34
-
If you have the file open in the Editor, you can perform a compare from the Context Menu. – DaveShaw Nov 07 '11 at 20:46
4 Answers
Keyboard Shortcut for doing TFS Compare
In the Team Explorer window under Pending Changes:
- shift + enter on file
- will compare the files
- shift + double click on file
- will compare file in background
- Create visual studio mapping for the commands:
Set the shortcut for compare folder under Source Control Explorer, you should set the shortcut keys for File.TfsFolderDiff command.
Set the shortcut for compare specific file under Source Control Explorer, you should set the shortcut keys for File.TfsCompare command
Note: To set the keyboard shortcuts, open "Tools > Options". In the dialog that opens, go to "Keyboard". Example:
Note: The folder compare shortcut is only valid from the "Source Control Explorer". It is the same as right clicking in the "Source Control Explorer" and selecting "Compare...".
References:
-
New Url for the second link: http://alexmg.com/comparison-keyboard-shortcuts-for-pending-changes-in-tfs/ – ToastyMallows Apr 07 '15 at 18:49
-
-
1Might want to mention at the top of the answer that shortcut keys refer to the Team Explorer window. I'm assuming that's correct because that's when it worked for me. So Glad I found this. – Tony L. Jan 20 '17 at 21:28
-
You can switch the double-click behaviour in the pending changes window to do a compare with latest by changing a registry setting:
Path: HKCU\Software\Microsoft\VisualStudio\<ver>\
TeamFoundation\SourceControl\Behavior
Value: DoubleClickOnChange (DWORD)
0 == view as the primary command (default)
1 == compare as primary command
You can find more information here:
A comment on that post also shows the entry to set if you want to use a shortcut key to do the comparison instead.

- 25,801
- 18
- 85
- 151

- 12,456
- 3
- 46
- 62
-
Just a note that, currently double clicking a file in the pending changes window opens the file . After making the above change, you will have to right click the file and then choose Open to open the file in the editor window. – Varun Sharma Jun 07 '17 at 21:31
You can add hotkey bindings for TFS context menu commands, which may be an approach that will work for what you need.
Go to Tools > Options > Keyboard. In the 'filter' field, type 'TFS' and it'll show a list of all TFS commands that you can bind hotkeys to. The Source Control comparison ones can be shortlisted with "CompareWith". I've bound hotkeys in this way to the pending changes window's context menu, which is a great timesaver versus working your way down that tortuous context menu, but there may be other options that suit your needs better.

- 56,972
- 11
- 108
- 137
Another alternative could be to set up an alias in Command Window and use it. To bring up the compare window: Open Command Window (ctrl + alt + A) Set alias for File.TfsCompare
alias diff File.TfsCompare
Next time you need to do the compare, type 'diff' and hit enter in the command window. 'diff' is an alias name, could be set to whatever of your choice. If you want to delete alias, use
alias aliasName /d

- 4,105
- 7
- 38
- 63