From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Bryan Turner <bturner@atlassian.com>
Cc: Git Mailing list <git@vger.kernel.org>
Subject: Re: why does "git revert" commit even if i try to bail with ":q!"?
Date: Tue, 12 Mar 2019 14:22:08 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.2.21.1903121421140.18110@localhost.localdomain> (raw)
In-Reply-To: <CAGyf7-FDLA7zZ9y3GyyVsF38hmm8E+-4+n8gAtmYnp4g7E7=Ug@mail.gmail.com>
On Tue, 12 Mar 2019, Bryan Turner wrote:
> On Tue, Mar 12, 2019 at 11:01 AM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> >
> > On Tue, 12 Mar 2019, Bryan Turner wrote:
> >
> > > On Tue, Mar 12, 2019 at 10:23 AM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> > > >
> > > > never noticed this before ... when i do a regular "git commit" and
> > > > enter my "vi" edit session and change my mind, i can bail with ":q!",
> > > > regardless of what i've set up as a commit message, and i'll see:
> > > >
> > > > Aborting commit due to empty commit message.
> > > >
> > > > however, i was just playing with "git revert" and, after i ran:
> > > >
> > > > $ git revert <commit SHA>
> > > >
> > > > again, simulating that i changed my mind, i just typed ":q!", but
> > > > the revert went ahead, anyway. i tried again, this time completely
> > > > deleting all the lines from the commit msg (as the template
> > > > suggested), but the revert *still* completed after typing ":q!".
> > > >
> > > > it was only after deleting all the lines and using ":wq" that the
> > > > revert was cancelled:
> > > >
> > > > Aborting commit due to empty commit message.
> > > >
> > > > that seems ... inconsistent. am i misunderstanding something?
> > >
> > > When you're doing a fresh commit, the .git/COMMIT_MSG is "empty". It
> > > has whitespace and comments, but no _usable_ lines. So when you :q!,
> > > the commit is aborted because nothing Git can use as a commit
> > > message was saved to the file and so it's still "empty".
> >
> > no, if i enter the commit edit session, type some _usable_ lines,
> > then type ":q!", it *still* aborts the commit because of an empty
> > commit message. try it and tell me if it behaves differently for you.
>
> Sorry, perhaps I was unclear. Even if you _type_ something, unless
> you :w it's not _written_. So using :q! at that point is the same as
> if you typed nothing.
>
> But if you type something, then :w, then _as a separate command_, do
> :q!, the commit _will_ be done.
>
> Is that more clear, I hope?
> Bryan
yes, i appreciate all the clarification.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca/dokuwiki
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
next prev parent reply other threads:[~2019-03-12 18:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 17:22 why does "git revert" commit even if i try to bail with ":q!"? Robert P. J. Day
2019-03-12 17:53 ` Bryan Turner
2019-03-12 18:01 ` Robert P. J. Day
2019-03-12 18:19 ` Bryan Turner
2019-03-12 18:22 ` Robert P. J. Day [this message]
2019-03-12 18:14 ` Robert P. J. Day
2019-03-12 18:20 ` SZEDER Gábor
2019-03-12 18:20 ` Bryan Turner
2019-03-12 18:14 ` Kevin Daudt
2019-03-12 18:20 ` Robert P. J. Day
2019-03-12 18:24 ` Elijah Newren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.21.1903121421140.18110@localhost.localdomain \
--to=rpjday@crashcourse.ca \
--cc=bturner@atlassian.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox