Answer a question

This question and some others discuss how this could work on a Mac, but I couldn't find documentation from Microsoft or Atlassian on a way to do this on Windows without trying to make it the global Git setting. (I just prefer to change things within the IDE where possible.)

What are the parameters to use with the "Custom" settings in SourceTree's "Options" dialogue "Diff" tab, for diff'ing and merging with VS-Code?

Answers

There may be other better variations, but after some experiment I've found these work well enough...

  • Choose "Custom" for the "External Diff Tool" and "Merge Tool"

  • The "Diff Command" in both cases is the path to wherever VS-Code is installed, eg:

    C:\Program Files (x86)\Microsoft VS Code\Code.exe

  • The command-line arguments for Diff'ing are:

    --diff --wait "$LOCAL" "$REMOTE"

  • And for Merging:

    -n --wait "$MERGED"

The '-n' flag makes VS-Code open a new window, which I prefer since VS-Code opens so fast, but you can omit it. When dealing with merge conflicts, you have to close the file when you're done to continue. SourceTree doesn't seem to consistently delete the intermediate files it creates, but you can select, right-click and 'Remove' them from the un-staged file section easily enough.

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐