Set Visual Studio Code to be global Git editor on OSX

后端 未结 4 1809
Happy的楠姐
Happy的楠姐 2020-12-31 04:28

I want to set VS Code to be my default git editor for commands such as rebase. This doesn\'t seem to be documented on the VS Code website. I\'ve found a SO question about do

4条回答
  •  囚心锁ツ
    2020-12-31 05:12

    Under OS X El Capitan (10.11.4) I was able to setup the whole thing:

    1. Install Visual Code Studio on you OS X (make sure it's inside Applications folder /Applications)
    2. Create a link with name vscode that links to your Visual Studio (inside Applications folder)using below command (be sure to use correct paths).

    ** If ~/bin folder doesn't exists, just create it:

    cd ~ && mkdir bin

    If folder ~/bin exists just create a link:

    ln -s /Applications/Visual\Studio\Code.app/Contents/Resources/app/bin/code ~/bin/vscode

    1. Restart your terminal/shell and you should be able to open Visual Studio Code by typing vscode in terminal window.

    vscode

    1. Visual Studio should open. If not and you have error. Add ~/bin/ to your PATH under OS X. Follows this (How do I add ~/bin to my path?)
    2. Edit global git config file with ~/.gitconfig and set editor using code name. In my case it looks like this:

    [core]
    editor = vscode --wait

    OR type

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

    1. Save file & restart terminal window. That's it!. Now you should be able enter commits descriptions using Visual Studio Code!

提交回复
热议问题