Forum: Ruby on Rails Stuck on Git message

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2008-11-16 16:25
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?
2505b282d57c29be797dc35b245adb4c?d=identicon&s=25 Philip Hallstrom (Guest)
on 2008-11-16 17:48
(Received via mailing list)
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
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2008-11-16 22:15
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 <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)
2586dc0c5e1d36a404f62c317827c256?d=identicon&s=25 Fiver (Guest)
on 2009-01-15 21:00
(Received via mailing list)
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 Byrne <rails-mailing-l...@andreas-
A91bd6cef23eb3516245a092e196c4da?d=identicon&s=25 Maurício Linhares (mauricio)
on 2009-01-15 21:02
(Received via mailing list)
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)
26a81e5badb9e002ab9ed3542036e584?d=identicon&s=25 Michael Libby (Guest)
on 2009-01-15 21:12
(Received via mailing list)
On Thu, Jan 15, 2009 at 1:10 PM, Fiver <evanawitt@gmail.com> 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
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2009-01-15 22:17
Michael Libby wrote:
> On Thu, Jan 15, 2009 at 1:10 PM, Fiver <evanawitt@gmail.com> 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 :-)
68152a245602f451c583c71e97426560?d=identicon&s=25 Gustavo Akio Tominaga Sacomoto (Guest)
on 2009-01-15 22:25
(Received via mailing list)
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... :(

On Thu, Jan 15, 2009 at 6:11 PM, Michael Libby
<michael.c.libby@gmail.com> wrote:
> What's your output from
>
--
Obrigado,

Gustavo Sacomoto

Vice-gerente Geral
Qype Brasil

+55 (11) 76747726

www.qype.com.br
247cd3d37084a3d6794076207bd9fbd7?d=identicon&s=25 Bobnation (Guest)
on 2009-01-15 23:32
(Received via mailing list)
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 <rails-mailing-l...@andreas-s.net>
26a81e5badb9e002ab9ed3542036e584?d=identicon&s=25 Michael Libby (Guest)
on 2009-01-15 23:32
(Received via mailing list)
On Thu, Jan 15, 2009 at 3:17 PM, Pål Bergström
<rails-mailing-list@andreas-s.net> wrote:
>> ?
>
>
> Nothing.

Which means it's time for me to read the documentation myself. :)

http://www.kernel.org/pub/software/scm/git/docs/gi... 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
26a81e5badb9e002ab9ed3542036e584?d=identicon&s=25 Michael Libby (Guest)
on 2009-01-15 23:34
(Received via mailing list)
On Thu, Jan 15, 2009 at 4:32 PM, Michael Libby
<michael.c.libby@gmail.com> 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
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2009-01-15 23:42
Michael Libby 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.
26a81e5badb9e002ab9ed3542036e584?d=identicon&s=25 Michael Libby (Guest)
on 2009-01-15 23:52
(Received via mailing list)
On Thu, Jan 15, 2009 at 4:42 PM, Pål Bergström
<rails-mailing-list@andreas-s.net> 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
This topic is locked and can not be replied to.