TFS shortcut to compare a modified file with the l

2019-03-11 16:46发布

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?

标签: tfs
4条回答
霸刀☆藐视天下
2楼-- · 2019-03-11 17:16

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...".

How to apply keyboard shortcut

References:

查看更多
贼婆χ
3楼-- · 2019-03-11 17:16

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楼-- · 2019-03-11 17:17

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.

查看更多
你好瞎i
5楼-- · 2019-03-11 17:39

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.

查看更多
登录 后发表回答