Stuck on Git message


#1

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?


#2

On Nov 16, 2008, at 7:25 AM, Pål Bergström wrote:

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.

Or, do it this way:

git ci -m “this is my commit message”

-philip


#3

Pål Bergström wrote:

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

git commit -m | 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)


#4

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.

On Nov 16 2008, 2:15 pm, James B. <rails-mailing-l…@andreas-


#5

On Thu, Jan 15, 2009 at 1:10 PM, Fiver removed_email_address@domain.invalid wrote:

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?

What’s your output from

git config --get core.editor

?


Michael C. Libby
www.mikelibby.com


#6

Michael L. wrote:

On Thu, Jan 15, 2009 at 1:10 PM, Fiver removed_email_address@domain.invalid wrote:

What’s your output from

git config --get core.editor

?

Nothing.

I got the screencast at peepcode, which was very good. I’m more into git
now, thanks :slight_smile:


#7

Close the editor.

If you’re using “nano”, it’s Ctrl+X.

Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)


#8

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… :frowning:

On Thu, Jan 15, 2009 at 6:11 PM, Michael L.
removed_email_address@domain.invalid wrote:

What’s your output from


Obrigado,

Gustavo Sacomoto

Vice-gerente Geral
Qype Brasil

+55 (11) 76747726

www.qype.com.br


#9

If you are using vi/Vim … try pressing Esc and then :qw and hit
Enter. That should quit you out of there.

On Jan 15, 3:17 pm, Pål Bergström removed_email_address@domain.invalid


#10

On Thu, Jan 15, 2009 at 3:17 PM, Pål Bergström
removed_email_address@domain.invalid wrote:

?

Nothing.

Which means it’s time for me to read the documentation myself. :slight_smile:

http://www.kernel.org/pub/software/scm/git/docs/git-commit.html 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”

-Michael


Michael C. Libby
www.mikelibby.com


#11

On Thu, Jan 15, 2009 at 4:32 PM, Michael L.
removed_email_address@domain.invalid wrote:

vi saves and exits with :wq

Note: you may need to press ESC first if you are in edit mode.


Michael C. Libby
www.mikelibby.com


#12

On Thu, Jan 15, 2009 at 4:42 PM, Pål Bergström
removed_email_address@domain.invalid wrote:

Then it’s vi I have.

You can change that with:

git config --global core.editor [your_favorite_editor]

or by setting GIT_EDITOR environment variable

unless you like vi, that is.

I learned to do:

git commit -a -v -m “message”

I understand -a and -m but not 100% on what -v does. I think it has to
do what it saves. With -v it only saves changed content. But not sure.

-v adds a bunch of text to the commit message, specifically a diff of
all the exact changes made by this commit.

Regards,
Michael


Michael C. Libby
www.mikelibby.com


#13

Michael L. wrote:
e 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”

Then it’s vi I have.

I learned to do:

git commit -a -v -m “message”

I understand -a and -m but not 100% on what -v does. I think it has to
do what it saves. With -v it only saves changed content. But not sure.

Anyway, it works great. So much easier than svn, that I never got into.