These are chat archives for codebar/tutorials

13th
Sep 2014
Carolina Sawney
@assembly21
Sep 13 2014 11:09

Done.

I was doing an online tutorial on Git. The tutor suggests to link Git to a text editor by writing this line:

git config —global core.editor “emacs -wl1” 


Here's the transcription:

"I want to show you two more useful ones now. The first is to tell Git what Text Editor you will be using. This allows Git to open up text that needs editing in that editor by default.

There are times when Git is going to want to have you edit a message and so it'll pop up that message in a Text Editor, let you change it, and then close it. And Git will go ahead with what it was going to do. The way we do that is with git config --global and then core.editor and then after that in quotes let's put the name of the editor that we want to use. So if you like using Unix's nano, you can put that there, you can use vim, or emacs, if you are on Windows, you can use notepad.exe, that comes by default with Windows.

I'd like to use TextMates, so I am going to be using M A T E, which is a little program that TextMate provides that sits inside Unix, and it can then launch TextMate. In addition to just launching it though, we need to provide a couple of options with it, which is the -w option, which says, hey after you launch it, wait until TextMate is done before you keep going with what you were going to do Unix, so we need that W option otherwise Unix will open it and then just keep going further as I was doing without waiting for you to finish the message, and then l1 also tells it to start at line 1".

I don’t understand if this should be the IDE, like Komodo, Aptana, IntelligIDEA, etc or a simple text editor like the one he mentions. Apart from the IDE editor, I have TextEdit on the Mac and no idea if this has anything to do with what he is talking about.

Making progress already. Very happy. Thanks.

Alexander Jahraus
@fanaugen
Sep 13 2014 13:27

Since the git config is not for all eternity (can be changed at any time), just pick any editor you like, and that can be launched from the command line by typing a command. Git will then invoke that command whenever it wants you to edit something, such as a commit message. Emacs and vim are editors that will open right inside the CLI (Terminal on Mac OS X), while other editors and IDEs will open in a separate window.

You mentioned TextEdit on Mac OS X, however I’d recommend picking a more code-focused one, such as the free TextWrangler or the hip cool new Atom editor by GitHub (the latter has some bugs and can be slow to start though). Both will let you install a command that’ll launch the editor (it’s edit for TextWrangler, and atom for Atom), which you can then add to the Git config with

git config --global core.editor "edit --wait --resume "$@""

source