[HN Gopher] Show HN: `Git add -p` with multiple buckets
       ___________________________________________________________________
        
       Show HN: `Git add -p` with multiple buckets
        
       Author : aleclm
       Score  : 55 points
       Date   : 2022-03-19 16:47 UTC (6 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | dorianmariefr wrote:
       | I feel like this should be part of git, also naming it git-split-
       | patch and having it in the PATH would allow to to do `git split-
       | patch`
        
         | aleclm wrote:
         | Yeah, that's what I want to do next.
        
       | renewiltord wrote:
       | Oh this is interesting. Sometimes I make unrelated changes and
       | then I want to tease the things apart at commit time. And when I
       | do I find that I don't just want to stage or skip staging. Worth
       | a shot but I'd prefer if I could put it into secondary staging
       | and post-commit the first of those becomes staged.
       | 
       | Probably doable and shiftable to a git-splitpatch too.
        
         | Sharlin wrote:
         | In modern gits you can also `git stash -p` allowing you to use
         | (named if needed) stashes for that purpose.
        
           | aleclm wrote:
           | This is different.
           | 
           | The key value of `split-patch` is that you can create as many
           | patches (commits) as you want by doing a single pass over the
           | (potentially large) patchset.
           | 
           | If you're willing to do multiple passes over the patchset,
           | you could `git commit` right away.
           | 
           | Anyway, cool, I didn't know you could name stashes!
        
         | chx wrote:
         | perhaps as branches? then we can cherry pick those as needed.
        
           | OJFord wrote:
           | Stashes are more appropriate; since they're really just
           | handier references to commits they can be cherry-picked too,
           | as `stash@{N}` where N is the zero-based integer for which
           | one you want.
           | 
           | (You can even `git cherry-pick stash@{0}^` for the commit the
           | stash was made at. It really is just a commit made at that
           | point, with that parent, only without updating HEAD, or the
           | checked-out branch.)
        
       | fuzzy2 wrote:
       | Ah, finally changelists are coming to Git. Having worked with
       | Perforce, this certainly feels very familiar.
        
       | alfiedotwtf wrote:
       | Oh very nice! This almost seems obvious that it should be part of
       | git itself!
        
       | almog wrote:
       | Is the main use case being splitting large uncommitted change set
       | into logical units in _one pass_ rather than few iterations of
       | `git add -p && git commit`?
        
       | abalaji wrote:
       | This is great, I've been using Sublime Merge similarly in my
       | workflow. I stage individual files while drafting the commit
       | message and make sure to split lines across commits for logical
       | rollbacks. I personally find it a lot faster than using the CLI,
       | at least in this case.
        
         | barbazoo wrote:
         | I agree. For this workflow using a GUI to stage individual
         | lines is just a lot faster.
        
       ___________________________________________________________________
       (page generated 2022-03-19 23:00 UTC)