Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 1.69 KB

HowTo - Git and VS Code.md

File metadata and controls

72 lines (53 loc) · 1.69 KB

HowTo - Git and VS Code

REF.: How to use VS Code as your Git editor, difftool, and mergetool by Rob O'Leary
REF.: Visual Studio Code Homepage
REF.: nano – Text editor Homepage
REF.: Git - git-mergetool Documentation
REF.: Git - git-difftool Documentation


Make VS Code your Default Editor

git config --global core.editor 'code --wait'
# or
git config --global core.editor 'code --wait --new-window'
# skip '--global' to use for current project only

or

  • Type git config --global -e to open in editor, and add following lines:

    [core]
      editor = code --wait  # --new-window

Reset to Default Editor

git config --global --unset core.editor
# default is Nano

Make VS Code your Default Diff Tool

git config --global diff.tool vscode
git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'

or

  • Type git config --global -e to open in editor, and add following lines:

    [diff]
      tool = vscode
    [difftool "vscode"]
      cmd = code --wait --diff $LOCAL $REMOTE

Making VS Code your Default Merge Tool

git config --global merge.tool vscode
git config --global mergetool.vscode.cmd 'code --wait $MERGED'
git config --global mergetool.vscode.trustExitCode true

or

  • Type git config --global -e to open in editor, and add following lines:

    [merge]
      tool = vscode
    [mergetool "vscode"]
      cmd = code --wait $MERGED
      trustExitCode = true