9

I have configured my Git difftool to be VS Code:

[diff]
    tool = default-difftool
[difftool "default-difftool"]
    cmd = code --wait --new-window --diff $LOCAL $REMOTE
    prompt = false

This works fine, but when there are multiple files to diff, they get opened one by one (VS Code launches with a single file diff, I close VS Code, the next file diff opens, etc).

Is there a way to configure Git so that all diffs are opened at once in the same VS Code instance?

jenkins
  • 626
  • 1
  • 7
  • 19
  • Does this answer your question? [Open all files at once using VsCode as Git difftool and mergetool](https://stackoverflow.com/questions/59903078/open-all-files-at-once-using-vscode-as-git-difftool-and-mergetool) – Gino Mempin May 14 '23 at 04:21

1 Answers1

1
  1. Install the folder comparison extension for vscode: https://marketplace.visualstudio.com/items?itemName=moshfeu.compare-folders

  2. Configure Vscode as the git difftool. Add this to ~/.gitconfig

[diff]
    tool = default-difftool
[difftool "default-difftool"]
    cmd = code --wait --new-window --diff $LOCAL $REMOTE
  1. Invoke the git difftool command with -dir-diff option and COMPARE_FOLDERS set to diff
COMPARE_FOLDERS=DIFF git difftool --dir-diff commit1_SHA commit2_SHA
Aidan Gallagher
  • 173
  • 1
  • 7