1

My current git config core.editor returns dreamweaver which I set up two years ago from inside the app(IIRC), and now I don't use it. I am receiving error while amending the author of the last commit.

~$ git commit --amend --author="me <my@mail>"
hint: Waiting for your editor to close the file... fatal: cannot run 
dreamweaver: No such file or directory
error: unable to start editor 'dreamweaver'

How do I set it to use Xcode? I tried

git config --global core.editor="xcode"
error: invalid key: core.editor=Xcode

And from https://stackoverflow.com/questions/53550025/git-unable-to-start-xcode-from-terminal-on-mac-os-x, even though xed launches Xcode.

$ git config --global core.editor="xed"
error: invalid key: core.editor=xed

xed -w also launches Xcode so I tried the same instead of ="xed -w" but same error.

2

It's all about syntax sometimes :-)

git config --global core.editor 'xed -w'

Not sure whether you really want to wait for Xcode to launch each time you git commit something. Maybe vi or nano are the better options here.

| improve this answer | |
  • @ankiiiiiii Not sure whether you really want to wait for Xcode to launch every time you commit something. – nohillside Aug 25 '19 at 9:45
  • it would mostly be open. But seems like a trouble. Should I set it to a light weight editor? – ankii Aug 25 '19 at 9:46
  • @ankiiiiiii Well, I have set it to open a new buffer within (an already running) Emacs. Otherwise I would probably just use vi or nano – nohillside Aug 25 '19 at 9:48
  • If you primarily work with Xcode what's the harm in doing this? It will always be open and you get to use the editor and shortcuts you're most familiar with rather than get stuck trying to close vim. – Declan McKenna May 12 at 10:56
  • 1
    @DeclanMcKenna No harm at all if this is the case, sure :-) – nohillside May 12 at 11:22
1

I would never want to do what you want, I think it's a horrible idea, but I tried to, and I succeeded!

What did I do? Easy:

  1. Open Xcode and remove the splash window from the boot (in case it could create some mayhem).

  2. Find Xcode: well, it's hard to explain how, but I found it at /Applications/Xcode.app/Contents/MacOS/Xcode.

  3. Repeat your mistake:

    $ git config core.editor=/Applications/Xcode.app/Contents/MacOS/Xcode 
    error: invalid key: core.editor=/Applications/Xcode.app/Contents/MacOS/Xcode
    $ _
    
  4. Make it right:

    $ git config core.editor /Applications/Xcode.app/Contents/MacOS/Xcode 
    $ echo $?
    0
    $ _
    
  5. Cloned a repo, made a silly change, added it to the index.

  6. git commit, tada!

Editing commit message on Xcode

If you have any issues repeating this, go back to step 4.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .