"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: [rfc] stash command in got
To:
gameoftrees@openbsd.org
Date:
Fri, 17 Jun 2022 01:38:33 +1000

Download raw body.

Thread
  • Mark Jamsek:

    [rfc] stash command in got

  • On 22-06-16 05:26pm, 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.
    
    That's in large part how I use stash. For example, I'll be working on
    feature f, and bug b gets brought to my attention. So I stash f, fix and
    commit b, unstash f and continue.
    
    > 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
    
    tbh, now that you mention this and I think back, I really started using
    stash a lot when I switched to Fossil. And I think this is due to
    Fossil's lack of rebase and its persistent history. This is largely
    replaced with multiple checkouts like you've provided with worktrees in
    Got, but stash streamlines the process.
    
    > What advantages would a native stash feature offer?
    > 
    
    You've given me something to think about. At present, the best I can
    come up with is that stash is a convenient, quick context-switch for
    small tasks. 'got stash' and 'got stash pop' is pretty convenient. But,
    you're right, there is a workaround; however, till I try it, I don't
    know that it would be as quick and simple. Whether that convenience is
    worth the code cost is another question.
    
    It's late so I'm about to turn in but I'll think about this more and use
    the workaround for the time being. If I still miss stash, I'll see if
    I can come up with a decent argument to convince you.
    
    -- 
    Mark Jamsek <fnc.bsdbox.org>
    GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68
    
  • Mark Jamsek:

    [rfc] stash command in got