Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Visual Studio Code to be global Git editor on OSX

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 doing it for Windows, which sounds like it has mixed success: How to use Visual Studio Code as Default Editor for Git

Has anyone managed this on OSX?

like image 545
Simon B Avatar asked Jan 12 '16 14:01

Simon B


People also ask

How do I set Visual Studio as default editor for Git on Mac?

To do this, open up VS Code and type (command + shift + p) to open the command palette. From there, search for 'code' and select Shell Command: Install 'code' command in PATH. Quick tip: With this installed, you can also use the code . command.

How to set default Git editor in Visual Studio Code?

So Set the default git editor by executing that command in a command prompt window: The parameter -w, --wait is to wait for window to be closed before returning. Visual Studio Code is base on Atom Editor. if you also have atom installed execute the command atom --help. You will see the last argument in the help is wait.

How do I make Git wait in Visual Studio Code?

$ git config --global core.editor "code --wait" This adds the following configuration to your global git config. [core] editor = code --wait By passing the --wait to the code command you tell Visual Studio Code to wait for you to close the file before returning to the terminal.

Can I use Git with Visual Studio Code?

Once you use git over the command-line you'll find yourself sometimes using a terminal text editor. Which might be fine for you. But if you're the integrated terminal in Visual Studio Code it might feel a bit awkward. In this case you can set Visual Studio Code as the default editor for git.

How to use VS Code as a Git editor?

Before you can use VS Code as a git editor you must ensure you can access and run it from the command line. You can test the access VS Code by running the CLI command below. If the command is not found you must introduce VS Code to your operating system to can run it from CLI:


1 Answers

This work for me.

Install "code" from VSCode commander (Shift + Command + P)

Search for:

Shell Command: Install 'code' command in 'PATH'

Install it.

after that… run commands on terminal for config git with new editor:

$ git config --global core.editor "code --wait" $ git config --global -e 
like image 65
Carlos J. Diaz Flores Avatar answered Sep 22 '22 18:09

Carlos J. Diaz Flores