{"thread":{"id":"48629","subject":"does a stash *need* any reference to the branch on which it was created?","startedAt":"2018-06-02T19:30:16Z","lastAt":"2018-06-04T10:13:16Z","messageCount":4,"participants":["Robert P. J. Day","Thomas Gummerer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"349097","messageId":"alpine.LFD.2.21.1806021525120.19865@localhost.localdomain","threadId":"48629","inReplyTo":null,"subject":"does a stash *need* any reference to the branch on which it was created?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2018-06-02T19:28:09Z","receivedAt":"2018-06-02T19:30:16Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"\n  i realize that, when you \"git stash push\", stash graciously saves\nthe branch you were on as part of the commit message, but does any\nsubsequent stash operation technically *need* that branch name?\n\n  it doesn't seem like it -- even \"git stash branch\" really only needs\nthe commit that was the basis of that stash to create the new branch.\n\n  so, does any stash operation actually need the originating branch\nname? (i'm guessing no, but i've been wrong before.)\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                  http://crashcourse.ca/dokuwiki\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================\n"},{"id":"349099","messageId":"20180602204650.GE26159@hank.intra.tgummerer.com","threadId":"48629","inReplyTo":"alpine.LFD.2.21.1806021525120.19865@localhost.localdomain","subject":"Re: does a stash *need* any reference to the branch on which it was created?","fromName":"Thomas Gummerer","fromEmail":"t.gummerer@gmail.com","sentAt":"2018-06-02T20:46:50Z","receivedAt":"2018-06-02T20:46:17Z","isPatch":false,"sender":{"key":"t.gummerer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/191004?v=4"},"body":"On 06/02, Robert P. J. Day wrote:\n> \n>   i realize that, when you \"git stash push\", stash graciously saves\n> the branch you were on as part of the commit message, but does any\n> subsequent stash operation technically *need* that branch name?\n\n    $ git stash list\n    stash@{0}: WIP on master: 4e5a9c0166 checkout & worktree: introduce checkout.defaultRemote\n                      ^^^^^^\n\nDo you mean this branch name?  If so, no, afaik nothing in git stash\nneeds that.  It's merely a convenience for the user so they know which\nbranch the stash was based on.\n\n>   it doesn't seem like it -- even \"git stash branch\" really only needs\n> the commit that was the basis of that stash to create the new branch.\n\nCorrect, and it knows that by checking the parents of the stash (note\nthat a stash is represented internally as just a commit):\n\n    $ git cat-file commit stash@{0}                                                                                                                                                                          ∞\n    tree 9fc2608506404bebdeb0aea54e8c76944ae88a1a\n    parent 4e5a9c01669919bcc2452e8e2491ee31dbf647fc\n    parent 9e457faad129f832ce0070dcfd1f4cfd3f322df3\n    author Thomas Gummerer <t.gummerer@gmail.com> 1527971565 +0100\n    committer Thomas Gummerer <t.gummerer@gmail.com> 1527971565 +0100\n\n    WIP on master: 4e5a9c0166 checkout & worktree: introduce checkout.defaultRemote\n\nThe first parent here is the commit the stash is based on, so that's\nwhat 'git stash branch' is using to base the new branch on.\n\n>   so, does any stash operation actually need the originating branch\n> name? (i'm guessing no, but i've been wrong before.)\n> \n> rday\n> \n> -- \n> \n> ========================================================================\n> Robert P. J. Day                                 Ottawa, Ontario, CANADA\n>                   http://crashcourse.ca/dokuwiki\n> \n> Twitter:                                       http://twitter.com/rpjday\n> LinkedIn:                               http://ca.linkedin.com/in/rpjday\n> ========================================================================\n"},{"id":"349205","messageId":"xmqq4lij6ym4.fsf@gitster-ct.c.googlers.com","threadId":"48629","inReplyTo":"alpine.LFD.2.21.1806021525120.19865@localhost.localdomain","subject":"Re: does a stash *need* any reference to the branch on which it was created?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-06-04T03:04:35Z","receivedAt":"2018-06-04T03:04:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n\n>   i realize that, when you \"git stash push\", stash graciously saves\n> the branch you were on as part of the commit message, but does any\n> subsequent stash operation technically *need* that branch name?\n\nIt is not \"saves\", but \"the message it automatically generates\nincludes <branch> and <commit title> as a human readable reminder\".\n\n\"git stash\" does not have to read that message, as it is not\nprepared to read and understand what you wrote after you ran your\nown \"git stash push -m 'my random message'\" anyway.  It is merely\nfor your consumption, especially when it appears in \"git stash list\".\n"},{"id":"349224","messageId":"alpine.LFD.2.21.1806040609290.7584@localhost.localdomain","threadId":"48629","inReplyTo":"xmqq4lij6ym4.fsf@gitster-ct.c.googlers.com","subject":"Re: does a stash *need* any reference to the branch on which it was created?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2018-06-04T10:11:00Z","receivedAt":"2018-06-04T10:13:16Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"On Mon, 4 Jun 2018, Junio C Hamano wrote:\n\n> \"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n>\n> >   i realize that, when you \"git stash push\", stash graciously\n> > saves the branch you were on as part of the commit message, but\n> > does any subsequent stash operation technically *need* that branch\n> > name?\n>\n> It is not \"saves\", but \"the message it automatically generates\n> includes <branch> and <commit title> as a human readable reminder\".\n\n  sorry, poor choice of words (particularly embarrassing as i'm such a\nstickler for wording :-P)\n\n> \"git stash\" does not have to read that message, as it is not\n> prepared to read and understand what you wrote after you ran your\n> own \"git stash push -m 'my random message'\" anyway.  It is merely\n> for your consumption, especially when it appears in \"git stash\n> list\".\n\n  right, that's what i wanted to confirm, thanks.\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                  http://crashcourse.ca/dokuwiki\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================\n"}]}