DEV Community

Cover image for Setting Visual Studio Code as your git merge and diff tool
Leandro Cavalcante
Leandro Cavalcante

Posted on

1

Setting Visual Studio Code as your git merge and diff tool

Paste the following lines in your ~/.gitconfig file:

# This is Git's per-user configuration file.
[core]
    editor = code --wait
[diff]
    tool = default-difftool
[difftool "default-difftool"]
    cmd = code --wait --diff $LOCAL $REMOTE
[merge]
    tool = default-mergetool
[mergetool "default-mergetool"]
    cmd = code --wait $MERGED
Enter fullscreen mode Exit fullscreen mode

Done! Next time you do a git commit or whatever operation that needs a text editor, Visual Studio Code will be opened as your default editor.

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more