Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View ALL Git diffs at once inside VS Code (or other difftools)

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?

like image 592
jenkins Avatar asked Mar 22 '19 14:03

jenkins


People also ask

How do I see git changes in Visual Studio code?

The Git icon on the left will always indicate an overview of how many changes you currently have in your repository. Clicking it will show you the details of your current repository changes: unstaged, staged and unresolved conflicting merge changes.


1 Answers

  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
like image 152
Aidan Gallagher Avatar answered Sep 19 '22 00:09

Aidan Gallagher