From: Tracey Emery Subject: Re: [rfc] stash command in got To: Mark Jamsek , gameoftrees@openbsd.org Date: Thu, 16 Jun 2022 09:33:10 -0600 On Thu, Jun 16, 2022 at 05:26:33PM +0200, Stefan Sperling wrote: > On Fri, Jun 17, 2022 at 12:57:27AM +1000, Mark Jamsek wrote: > > I posed the question offlist to Stefan who suggested it should be > > discussed on the list. > > > > I want to add horizontal splitscreen mode to tog next, but after this > > I thought I'd try to implement stash. I use it a _lot_ in Fossil, and > > it's something I'd like to have in Got. > > > > Are there any objections? If not, what are some things that should be > > considered? > > What do you use the stash feature for? > > I have rarely used stash in Git. When I used it was mostly to undo > local changes quickly to test something, as a kind of temporary revert. > > A major use case of stash, at least as I understand it, is to quickly > save local changes away before switching to a different task. It seems > creating a new branch and comitting to this branch already covers this > use case, and saves us from implementing a lot of functionality which > essentially duplicates branching (create stash), committing (stash changes), > viewing history (list stashed changes), and merging/rebasing/cherrypick > (retrieve a change from the stash). > > So the feature seems to introduce a lot of redundancy. > For this reason I am not a huge fan of stash as an extra feature. > > Just to illustrate, in order to create a stash during a quick task context > switch, you could do something like this in a script: > > mybranch=$(got br) > got branch mystash > got commit -m stash > got up -b $mybranch > > What advantages would a native stash feature offer? > Sure, this works in one direction. What's the quick way to pop it back to mybranch? A diff has to be created and patched back to mybranch and mystash deleted, correct? Or is there a quicker way in a script like this? -- Tracey Emery