Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Change the Default Editor for Git [duplicate]

Tags:

git

terminal

I just started using git about a month ago. It was set up for me using TextMate as my default editor for commits. However, I'd like to switch the default to TextWrangler which I already have installed. I looked around online and found a line of code to type into the terminal to do this. So I opened the terminal and typed:

cd Desktop cd "projectName" git config --global core.editor TextWrangler git status git add. git commit  //then the error comes up 

The error says: error: cannot run TextWrangler: No such file or directory error: There was a problem with the editor 'TextWrangler'. Please supply the message using either -m or -F option.

I don't know what this means or what I am doing wrong. I am sure its an obvious mistake, but can anyone explain how to fix this?

like image 292
jac300 Avatar asked Nov 06 '12 18:11

jac300


People also ask

How do I change the default git editor?

The command to do this is git config --global core. editor "nano" . You can change the highlighted section with your editor of choice!

How do I change from git editor to Notepad ++?

Changing the Git editor to Notepad++ Obviously, on an x64 machine, Notepad++ would be found under the Program Files (x86) directory. The bottom line is that when you run this command, make sure you provide the correct location of your text editor of choice.

How Do I Get Out of git editor?

Type :wq to save and exit the editor. Hit enter to return to the normal terminal window.


2 Answers

Just answered my own question with the help of the above comments... to switch to TextWrangler as the default for Git, you must open TextWrangler, click on TextWrangler in the tool bar and select "install command line tools" from the drop down. Then go into command line and type:

git config --global core.editor "edit -w" 

Edit is the command that is understood in the command line which means to open a textWrangler file.

like image 166
jac300 Avatar answered Sep 22 '22 23:09

jac300


Follow-up to @thornomad

Command for changing editor in Git is (one of possibilities)

git config --global core.editor "mate -w", there string inside quotes marks is full command-line for invoking editor from terminal

like image 25
Lazy Badger Avatar answered Sep 22 '22 23:09

Lazy Badger