Re: why does "git revert" commit even if i try to bail with ":q!"?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 12 Mar 2019, Bryan Turner wrote:

> On Tue, Mar 12, 2019 at 10:23 AM Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> 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.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux