git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* "git add -p" versus "git add -i", followed by "p"
@ 2018-12-02 16:30 Robert P. J. Day
  2018-12-02 16:52 ` Kevin Daudt
  2018-12-02 16:56 ` SZEDER Gábor
  0 siblings, 2 replies; 9+ messages in thread
From: Robert P. J. Day @ 2018-12-02 16:30 UTC (permalink / raw)
  To: Git Mailing list


  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?

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Kevin Daudt @ 2018-12-02 16:52 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Git Mailing list

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?
> 
> rday
> 
> -- 
> 

After selecting 'p', what do you get?

You should see a list of modified files. You can select the files you
want to stage by the listed numbers. After you selected those files, you
press enter, and then you will get the options you'll also see with git
add -p.

Kevin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  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:56 ` SZEDER Gábor
  2018-12-02 17:01   ` Robert P. J. Day
  2018-12-02 17:03   ` Robert P. J. Day
  1 sibling, 2 replies; 9+ messages in thread
From: SZEDER Gábor @ 2018-12-02 16:56 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Git Mailing list

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?

  diff --git a/README.md b/README.md
  index f920a42fad..63dee5cfc3 100644
  --- a/README.md
  +++ b/README.md
  @@ -62,3 +62,4 @@ and the name as (depending on your mood):
   [Documentation/giteveryday.txt]: Documentation/giteveryday.txt
   [Documentation/gitcvs-migration.txt]:
  Documentation/gitcvs-migration.txt
   [Documentation/SubmittingPatches]: Documentation/SubmittingPatches
  +New content
  Stage this hunk [y,n,q,a,d,e,?]? y
  
  diff --git a/contrib/README b/contrib/README
  index 05f291c1f1..2b152dfcff 100644
  --- a/contrib/README
  +++ b/contrib/README
  @@ -41,3 +41,4 @@ submit a patch to create a subdirectory of contrib/
  and put your
   stuff there.
   
   -jc
  +New content
  Stage this hunk [y,n,q,a,d,e,?]? n
  
  *** Commands ***
    1: status       2: update       3: revert       4: add untracked
    5: patch        6: diff         7: quit         8: help
  What now> q
  Bye.
  $ git diff --cached 
  diff --git a/README.md b/README.md
  index f920a42fad..63dee5cfc3 100644
  --- a/README.md
  +++ b/README.md
  @@ -62,3 +62,4 @@ and the name as (depending on your mood):
   [Documentation/giteveryday.txt]: Documentation/giteveryday.txt
   [Documentation/gitcvs-migration.txt]: Documentation/gitcvs-migration.txt
   [Documentation/SubmittingPatches]: Documentation/SubmittingPatches
  +New content
  $


Arguably the documentation could make it clear that the user can
choose multiple files at once, e.g.:

diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index c9623854bf..061f9cbb0d 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -317,9 +317,9 @@ add untracked::
 
 patch::
 
-  This lets you choose one path out of a 'status' like selection.
-  After choosing the path, it presents the diff between the index
-  and the working tree file and asks you if you want to stage
+  This lets you choose one or more paths out of a 'status' like selection.
+  After choosing the path(s), it presents the diff between the index
+  and the working tree file(s) and asks you if you want to stage
   the change of each hunk.  You can select one of the following
   options and type return:
 
And perhaps we could have a dedicated menu entry for "I'm done with
selecting paths"?  Dunno; I'm a 'git add -p' user myself.


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  2018-12-02 16:52 ` Kevin Daudt
@ 2018-12-02 16:59   ` Robert P. J. Day
  0 siblings, 0 replies; 9+ messages in thread
From: Robert P. J. Day @ 2018-12-02 16:59 UTC (permalink / raw)
  To: Kevin Daudt; +Cc: Git Mailing list

On Sun, 2 Dec 2018, Kevin Daudt 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?
>
> After selecting 'p', what do you get?
>
> You should see a list of modified files. You can select the files
> you want to stage by the listed numbers. After you selected those
> files, you press enter, and then you will get the options you'll
> also see with git add -p.

$ git add -i
           staged     unstaged path
  1:    unchanged       +12/-0 README.asc

*** Commands ***
  1: [s]tatus	  2: [u]pdate	  3: [r]evert	  4: [a]dd untracked
  5: [p]atch	  6: [d]iff	  7: [q]uit	  8: [h]elp
What now> p
           staged     unstaged path
  1:    unchanged       +12/-0 [R]EADME.asc
Patch update>> 1
           staged     unstaged path
* 1:    unchanged       +12/-0 [R]EADME.asc
Patch update>> 1
           staged     unstaged path
* 1:    unchanged       +12/-0 [R]EADME.asc
Patch update>>

  and ... then what?

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Robert P. J. Day @ 2018-12-02 17:01 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Git Mailing list

[-- Attachment #1: Type: text/plain, Size: 2887 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?

  ah, so after selecting the files to selectively stage, one enters a
simple CR. got it. not sure that's obvious from the docs but i'll
verify that.

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  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
  2018-12-02 17:09     ` Duy Nguyen
  1 sibling, 1 reply; 9+ messages in thread
From: Robert P. J. Day @ 2018-12-02 17:03 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Git Mailing list

[-- 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
========================================================================

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  2018-12-02 17:03   ` Robert P. J. Day
@ 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
  0 siblings, 2 replies; 9+ messages in thread
From: Duy Nguyen @ 2018-12-02 17:09 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: SZEDER Gábor, Git Mailing List

On Sun, Dec 2, 2018 at 6:05 PM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> >   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.

I think it's the same procedure as the "update" step, which describes
this in more detail. I agree that the "patch" section does not make
this obvious.
-- 
Duy

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Robert P. J. Day @ 2018-12-02 17:30 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: SZEDER Gábor, Git Mailing List

On Sun, 2 Dec 2018, Duy Nguyen wrote:

> On Sun, Dec 2, 2018 at 6:05 PM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> > >   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.
>
> I think it's the same procedure as the "update" step, which
> describes this in more detail. I agree that the "patch" section does
> not make this obvious.

  thanks, i was hoping i wasn't being a complete idiot. given time, i
may submit a patch to fix the man page unless someone else gets to it
first.

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: "git add -p" versus "git add -i", followed by "p"
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Robert P. J. Day @ 2018-12-08 16:22 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: SZEDER Gábor, Git Mailing List

On Sun, 2 Dec 2018, Duy Nguyen wrote:

> On Sun, Dec 2, 2018 at 6:05 PM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> > >   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.
>
> I think it's the same procedure as the "update" step, which
> describes this in more detail. I agree that the "patch" section does
> not make this obvious.

  when i get a chance, i'll try to reword it.

rday

-- 

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-12-08 16:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).