Open bseitz234 opened 9 years ago
That is definitely my bad! Try it all lowercase and let me know if that fixes it.
git config --global core.editor "textedit -w"
I'll update the webpage now!
Unfortunately, still not working. What's odd is that if I leave git out of it:
$ open "/Applications/TextEdit.app"
works fine.
with or without git, I get the "command not found" unless I specify to look in the /Applications folder.
$ git commit
textedit -w: textedit: command not found
error: There was a problem with the editor 'textedit -w'.
Please supply the message using either -m or -F option.
$ open textedit
or $ open textedit.app
or $open TextEdit.app
.... or even just $ textedit
all return command not found
.
Updated 5:00pm: So, how deep down the rabbit hole do you want to go on here, and/or would it be easier to skip TextEdit entirely and remind myself how to use emacs?
If I'm very explicit:
git config --global core.editor "/Applications/TextEdit.app/Contents/MacOS/TextEdit -w"
I can get TextEdit to start up in the background, but it doesn't actually give me a window to enter a commit message. Might need to play with more flags to make that happen.
I can get TextEdit to open and give me a window with: git config --global core.editor open
(uses the default system application for plain text, which in my case is TextEdit). Success!
...but, as soon as TextEdit opens, before I have a chance to type and save a commit message, I get
$ git commit
Aborting commit due to empty commit message.
because git isn't waiting for it. If I try to add the -w flag, bash gets mad because open
doesn't accept that flag.
What happens when you include a commit message? E.g.,
git commit -m 'testing out commit with message'
By default, git requires a commit message to enforce best practices in using version control. Commit messages should be concise but meaningful; generally a brief explanation of why a change was made, rather than what was done since you can just look at the change directly.
The real test of whether the TextEdit business will work will be when we have to do a merge commit.
I like knowing about the core.editor open
option! I'll add that to the list.
As long as I give it a message, it works just fine- it's just when it tries to open an external text editor to do a longer commit message.
It also works fine with emacs:
git config --global core.editor emacs
when I commit, launches emacs, where I can enter a message, save it, and quit emacs and come back to this:
$ git commit
[master f9efc80] The horses are magical.
1 file changed, 1 insertion(+), 1 deletion(-)
Also, open
works best for me if I use it with -W -n
as options:
$ git config --global core.editor "open -W -n"
(source and explanation of options: http://stackoverflow.com/questions/6435246/trouble-on-setting-the-git-core-editor)
it seems to only give me trouble if I try to refer to text edit explicitly, which is weird, and I'd like to know what's causing it.... but I'm OK with either using open
or emacs, so I think I'm good for now!
I wonder if this has something to do with opening a text editor external to the shell? This is why emacs or nano or somesuch works normally.
I was curious about that as well... but it does strike me as odd that it works with open
but not with calling TextEdit explicitly, even if I use the -W -n
flags.
What is TextEdit? Did I miss the class when this was covered? Oops.
I think we went over it pretty quickly... I wouldn't worry about this too much for now, as long as you include a message in your commits ( git commit -m "I made my commit for some reason that I describe here"
).
But, if you're curious: TextEdit is a simple, plain text editing program. The context of this issue is that git won't let you make a commit without a message explaining why. If you don't include one with the -m
flag, you can tell git to open a small message file in a text editor, where you can leave a longer, more detailed message. TextEdit is the built-in text editor on Macs, which has a nice simple graphical user interface. There are lots of other alternatives that are on the command line, but those can be a bit trickier to use.
Takeaway: I think $ git config --global core.editor "open -W -n"
should be all you need to set this up, and should work going forward.
git is giving me an error when it tries to launch TextEdit, and I'm wondering if someone might be able to help me out with it:
First I tried the simple command that was in the walkthrough to make TextEdit the editor:
git config --global core.editor "TextEdit -w"
which returned:
So I got a little more specific:
git config --global core.editor "/Applications/TextEdit.app -w"
and if I try a commit without a message, it returns the error message:
(As long as I include a message with
-m
, it doesn't bother with TextEdit and everything works just fine)On a whim, I tried without the
-w
, and gotAnd I think that's where I'm at... any ideas?
Thanks in advance!