git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* does a stash *need* any reference to the branch on which it was created?
@ 2018-06-02 19:28 Robert P. J. Day
  2018-06-02 20:46 ` Thomas Gummerer
  2018-06-04  3:04 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Robert P. J. Day @ 2018-06-02 19:28 UTC (permalink / raw)
  To: Git Mailing list


  i realize that, when you "git stash push", stash graciously saves
the branch you were on as part of the commit message, but does any
subsequent stash operation technically *need* that branch name?

  it doesn't seem like it -- even "git stash branch" really only needs
the commit that was the basis of that stash to create the new branch.

  so, does any stash operation actually need the originating branch
name? (i'm guessing no, but i've been wrong before.)

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] 4+ messages in thread

* Re: does a stash *need* any reference to the branch on which it was created?
  2018-06-02 19:28 does a stash *need* any reference to the branch on which it was created? Robert P. J. Day
@ 2018-06-02 20:46 ` Thomas Gummerer
  2018-06-04  3:04 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Gummerer @ 2018-06-02 20:46 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Git Mailing list

On 06/02, Robert P. J. Day wrote:
> 
>   i realize that, when you "git stash push", stash graciously saves
> the branch you were on as part of the commit message, but does any
> subsequent stash operation technically *need* that branch name?

    $ git stash list
    stash@{0}: WIP on master: 4e5a9c0166 checkout & worktree: introduce checkout.defaultRemote
                      ^^^^^^

Do you mean this branch name?  If so, no, afaik nothing in git stash
needs that.  It's merely a convenience for the user so they know which
branch the stash was based on.

>   it doesn't seem like it -- even "git stash branch" really only needs
> the commit that was the basis of that stash to create the new branch.

Correct, and it knows that by checking the parents of the stash (note
that a stash is represented internally as just a commit):

    $ git cat-file commit stash@{0}                                                                                                                                                                          ∞
    tree 9fc2608506404bebdeb0aea54e8c76944ae88a1a
    parent 4e5a9c01669919bcc2452e8e2491ee31dbf647fc
    parent 9e457faad129f832ce0070dcfd1f4cfd3f322df3
    author Thomas Gummerer <t.gummerer@gmail.com> 1527971565 +0100
    committer Thomas Gummerer <t.gummerer@gmail.com> 1527971565 +0100

    WIP on master: 4e5a9c0166 checkout & worktree: introduce checkout.defaultRemote

The first parent here is the commit the stash is based on, so that's
what 'git stash branch' is using to base the new branch on.

>   so, does any stash operation actually need the originating branch
> name? (i'm guessing no, but i've been wrong before.)
> 
> 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] 4+ messages in thread

* Re: does a stash *need* any reference to the branch on which it was created?
  2018-06-02 19:28 does a stash *need* any reference to the branch on which it was created? Robert P. J. Day
  2018-06-02 20:46 ` Thomas Gummerer
@ 2018-06-04  3:04 ` Junio C Hamano
  2018-06-04 10:11   ` Robert P. J. Day
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2018-06-04  3:04 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Git Mailing list

"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

>   i realize that, when you "git stash push", stash graciously saves
> the branch you were on as part of the commit message, but does any
> subsequent stash operation technically *need* that branch name?

It is not "saves", but "the message it automatically generates
includes <branch> and <commit title> as a human readable reminder".

"git stash" does not have to read that message, as it is not
prepared to read and understand what you wrote after you ran your
own "git stash push -m 'my random message'" anyway.  It is merely
for your consumption, especially when it appears in "git stash list".

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

* Re: does a stash *need* any reference to the branch on which it was created?
  2018-06-04  3:04 ` Junio C Hamano
@ 2018-06-04 10:11   ` Robert P. J. Day
  0 siblings, 0 replies; 4+ messages in thread
From: Robert P. J. Day @ 2018-06-04 10:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing list

On Mon, 4 Jun 2018, Junio C Hamano wrote:

> "Robert P. J. Day" <rpjday@crashcourse.ca> writes:
>
> >   i realize that, when you "git stash push", stash graciously
> > saves the branch you were on as part of the commit message, but
> > does any subsequent stash operation technically *need* that branch
> > name?
>
> It is not "saves", but "the message it automatically generates
> includes <branch> and <commit title> as a human readable reminder".

  sorry, poor choice of words (particularly embarrassing as i'm such a
stickler for wording :-P)

> "git stash" does not have to read that message, as it is not
> prepared to read and understand what you wrote after you ran your
> own "git stash push -m 'my random message'" anyway.  It is merely
> for your consumption, especially when it appears in "git stash
> list".

  right, that's what i wanted to confirm, thanks.

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] 4+ messages in thread

end of thread, other threads:[~2018-06-04 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-02 19:28 does a stash *need* any reference to the branch on which it was created? Robert P. J. Day
2018-06-02 20:46 ` Thomas Gummerer
2018-06-04  3:04 ` Junio C Hamano
2018-06-04 10:11   ` 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).