Skip to content

Setting up VSCode for Git

A hand holding a green plant

In the past, whenever I wished to edit a commit message, squash commits, or anything else git-related that requires dealing with the default Git editor (Vim in most cases), it always felt overwhelming. That's mainly due to me not being used to Vim.

When I discovered it was possible to set up Visual Studio Code (or VSCode) to achieve just this, it was such a relief! In this article, I go through the steps to set up VSCode as your Git editor.

Steps

  1. Add the following in ~/.gitconfig, under [core].

    editor = code --wait
  2. [Optional] I like to use GitLens' interactive rebase editor to get a GUI when rebasing. Hit Ctrl or cmd + Shift + P in VSCode, type 'GitLens: Enable Interactive Rebase Editor' and press Enter. Reload VSCode. Next time you run git rebase -i, a GUI will pop up inside VSCode.