How to use vscode as git editor

Stackoverflow gives Instructions to make vscode as git editor.

  1. Ensure Code is on shell path
  2. Set Code as the git editor

    git config --global core.editor "code --wait"

  3. Use Code to edit configurations

    git config --global -e

  1. Add configurations to use Code as default diff tool
    [diff]
     tool = default-difftool
    [difftool "default-difftool"]
     cmd = code --wait --diff $LOCAL $REMOTE