git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: Git Mailing list <git@vger.kernel.org>
Subject: Re: "git add -p" versus "git add -i", followed by "p"
Date: Sun, 2 Dec 2018 12:03:23 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.21.1812021201550.6459@localhost.localdomain> (raw)
In-Reply-To: <20181202165617.GG30222@szeder.dev>

[-- Attachment #1: Type: text/plain, Size: 2924 bytes --]

On Sun, 2 Dec 2018, SZEDER Gábor wrote:

> On Sun, Dec 02, 2018 at 11:30:19AM -0500, Robert P. J. Day wrote:
> >
> >   testing adding by patch for the very first time (i've just never
> > needed this), and reading the "progit" book and reading the man page,
> > and the impression i'm getting is that running "git add -p" (going
> > straight to patch mode) is supposed to be equivalent to running "git
> > add -i", then typing "p" to switch to patch mode.
> >
> >   that is most emphatically not what i'm seeing. if i run "git add
> > -p", then i get to what i expect -- the patch subsystem:
> >
> >   $ git add -p
> >   diff --git a/README.asc b/README.asc
> >   index fa40bad..840e85b 100644
> >   --- a/README.asc
> >   +++ b/README.asc
> >   @@ -1,3 +1,9 @@
> >   +change 1
> >   +
> >   +
> >   +
> >   +
> >   +
> >    = Pro Git, Second Edition
> >
> >    Welcome to the second edition of the Pro Git book.
> >   Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]?
> >
> > but if i start with "git add -i", there seems to be no way to get to
> > patch mode -- certainly "p" doesn't do it. am i stupidly missing
> > something trivial? is the explanation misleading or inncomplete?
>
> Worksforme™:
>
>   $ echo "New content" >>README.md
>   $ echo "New content" >>t/README
>   $ echo "New content" >>contrib//README
>   $ git add -i
>              staged     unstaged path
>     1:    unchanged        +1/-0 README.md
>     2:    unchanged        +1/-0 contrib/README
>     3:    unchanged        +1/-0 t/README
>
>   *** Commands ***
>     1: status       2: update       3: revert       4: add untracked
>     5: patch        6: diff         7: quit         8: help
>   What now> p
>              staged     unstaged path
>     1:    unchanged        +1/-0 README.md
>     2:    unchanged        +1/-0 contrib/README
>     3:    unchanged        +1/-0 t/README
>   Patch update>> 1
>              staged     unstaged path
>   * 1:    unchanged        +1/-0 README.md
>     2:    unchanged        +1/-0 contrib/README
>     3:    unchanged        +1/-0 t/README
>   Patch update>> 2
>              staged     unstaged path
>   * 1:    unchanged        +1/-0 README.md
>   * 2:    unchanged        +1/-0 contrib/README
>     3:    unchanged        +1/-0 t/README
>   Patch update>>
>
> Here I hit enter.  Did you?

  perhaps i'm just not seeing it, but from "man git-add", it doesn't
seem obvious that you would first select the files to work with, then
hit a simple CR to get into actual patch mode.

rday

-- 

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

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

  parent reply	other threads:[~2018-12-02 17:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-02 16:30 "git add -p" versus "git add -i", followed by "p" Robert P. J. Day
2018-12-02 16:52 ` Kevin Daudt
2018-12-02 16:59   ` Robert P. J. Day
2018-12-02 16:56 ` SZEDER Gábor
2018-12-02 17:01   ` Robert P. J. Day
2018-12-02 17:03   ` Robert P. J. Day [this message]
2018-12-02 17:09     ` Duy Nguyen
2018-12-02 17:30       ` Robert P. J. Day
2018-12-08 16:22       ` Robert P. J. Day

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.1812021201550.6459@localhost.localdomain \
    --to=rpjday@crashcourse.ca \
    --cc=git@vger.kernel.org \
    --cc=szeder.dev@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).