TFS shortcut to compare a modified file with the latest version

前端 未结 4 1423
星月不相逢
星月不相逢 2021-02-03 21:53

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?

相关标签:
4条回答
  • 2021-02-03 22:40

    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
    
    0 讨论(0)
  • 2021-02-03 22:43

    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:

    • Keyboard shortcut for File Compare?
    • Comparison keyboard shortcuts for Pending Changes in TFS by Alex Meyer-Gleaves.
    • How to Double Click to Diff Pending Changes in TFS by Richard Banks
    • TFS Shortcut to do a diff on all modified files with latest version
    0 讨论(0)
  • 2021-02-03 22:45

    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.

    0 讨论(0)
  • 2021-02-03 22:54

    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:

    • How to Double Click to Diff Pending Changes in TFS.

    A comment on that post also shows the entry to set if you want to use a shortcut key to do the comparison instead.

    0 讨论(0)
提交回复
热议问题