I'm trying to learn git. After doing the initial add . I come to a
message. Do I add my comment as a comment with # before my line, or
what? And how to I get out of there?
I've been trying to find a good tutorial but I can't find any that
explains this issue, so I get stuck. Are there any good tutorials about
git that really explains it without leaving out important parts like
this?
I'm guessing you typed "git ci" ? If so that will open up whatever editor is defined in the EDITOR environment variable. Write your message (without preceeding #'s) and then save.
I'm trying to learn git. After doing the initial add . I come to a
message. Do I add my comment as a comment with # before my line, or
what? And how to I get out of there?
I've been trying to find a good tutorial but I can't find any that
explains this issue, so I get stuck. Are there any good tutorials about
git that really explains it without leaving out important parts like
this?
The sequence is.
# git add <file or directory tree>
# git commit -m <comment here> | Insert as first line in message file
that editor opens.
If this is a local repository then you are done. If cloned from a
remote master then you need to follow the local commit with a
# git push
To see the current status of the local vs. the remote repository
# git status
To update the local from the remote
# git pull
peepcode.com has an excellent pdf book on git for $9.00, a great value.
They also have a screencast on git ($9.00) as does railscasts.com (free)
I've got the same problem as this guy, and these comments aren't
helping.
When get prompts me to enter my commit message, it opens an editor,
and I for the life of me can't figure out how to close it.
How do I let it know that I'm done with my message?
Sorry for the n00b questions.
Yeah, just close your editor and it will finish your message.
BTW, there is a great git tutorial on peepcode.com, the title is "Git
internals", it's quite big but I really understood git after reading
it, unfortunately it's not free...
Which means it's time for me to read the documentation myself.
git-commit(1) says:
"The editor used to edit the commit log message will be chosen from
the GIT_EDITOR environment variable, the core.editor configuration
variable, the VISUAL environment variable, or the EDITOR environment
variable (in that order)."
So if git config --get core.editor says nothing, then you need to find
the value of one of those environment variables to find out which
editor you're using.
If none of them are set, I have no idea what editor you're getting...
but you still need to save your changes to the file and exit the
editor.
Two probable default editors are nano and vi:
Nano exits with ctrl-x (and Y to question about saving changes).
vi saves and exits with :wq
If you don't need long commit messages you can avoid the editor entirely with:
git commit -m "your message here"