Replies: 4 comments 4 replies
|
Thanks so much for sharing, I also think this is useful and it's actually quite straightforward to implement. There already is a notion of creating the workspace merge commit by merging not the tip of the stack, but any commit further down. gitbutler/crates/but-core/src/ref_metadata.rs Lines 465 to 473 in 82ec107 This would have the desired effect of merging a different tree while officially claiming that the tip is merged. The GUI would need special support for visualising this correctly. CC @OliverJAsh . |
|
I agree this would be useful. I'm developing a feature in my application right now where I have a temporary test commit that I'm alternately including or not including on one of my virtual branches in my GitButler workspace. Unfortunately GitButler apparently doesn't provide a convenient way to do this yet. Prospective ways to address my current need:
|
problemim finding myself wanting to unapply a portion of a stacked branch quite often recently. my two use cases are:
in both cases it would be incredibly helpful to be able to pop a branch out of the stack (even if that would result in conflicts) while retaining the correlation to the stack, so i can then later reapply that branch to the same stack (again, even if that would result in conflicts) (or if the stack no longer exists, it would be the same as just regularly applying a branch to the workspace) workaroundi tried uncommitting the changes and then using the "Stash in Branch" functionality, but unfortunately that doesnt seem to be able to stash changes that are dependent on earlier changes in the stack -- it stashed everything except those dependent files. which kinda makes sense, but makes it unusable as a solution to my problem for those stumbling upon this, its jank but there is a workaround: stashing changes from the top of the stackto save:
to restore:
stashing changes from the middle of a stackto save:
to restore:
both of these only really work well if you're using a single commit per branch as i do (im an amend-er :3), but if you dont care about preserving git history you can always just squash the commits of the branch in question and then follow these steps. implementationit seems like the trickiest parts of implementing a feature like this would be tracking the correlation between an unapplied branch and the rest of the stack, and the UX of reapplying. under the hood this feels like it borders on/steps into non linear graph territory, because if you unapply a branch from the middle of the stack, you now have one graph path that goes from the base branch to the unapplied branch(es), and then one graph path that goes from the base branch to the rest of the applied stack. that being said, it sounds less complex than trying to support applied non linear graphs to the workspace (which id love, but i digress) because the workspace would still only ever have linear stacks applied. under the hood, the actual git logic for doing this feels in my mind quite simple. if i have A -> B -> C -> D, im imagining this:
so the main trickiness is keeping track of the relationships between A to B & C to D, and the boundaries of branches so you know what commits to drop when rebasing. there's also some open UX questions of "what if i have created/reordered branches since unapplying", in which case i think you'd need some kind of interactive picker to decide where you slot the branches back in. but the actual git operations would just be about rebasing and dropping the right commits. and all of this is with the assumption that conflicts might result from these operations and should be non-fatal to the operation, just like the behavior of existing operations like reorder, sync, edit mode, etc. path forwardgiven this is a feature i am pretty passionate about as it is something id use frequently in my daily workflow, id love to hear thoughts on whether this would be desirable functionality! unless this is absolutely not something the team is open to, then when i have the time im going to open an issue with an actual RFC grounded in implementation. with the full expectation that i would do the implementation work if the team signs off on it, im sure this isnt exactly trivial to build and that yall are busy af lol. to anyone else in this discussion, id love to hear if what ive proposed above would actually address your need! if not id love any feedback on what would work better for your situations |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Stacked branches are in theory a really useful way for me to work on a large piece of work that needs to be broken into several PRs.
However, the way we merge PR chains in our organisation is bottom up, i.e. each one is merged separately into
masterrather than top-down where each is merged down into a final large PR that can be merged intomaster. This means we can lower the risk of rollback by testing each individual change one at a time, and make it easier to identify the cause of issues compared to trying to unpick a massive PR.However, this creates a need to be able to test each branch independently of anything further up the chain. If I have
|- Feature 4
|- Feature 3
|- Feature 2
|- Feature 1
And I need to make a change to Feature 2, I want to be able to unapply just Features 3 and 4, as this will ensure that the correct functionality isn't predicated on something higher up that won't be merged until later.
What would be great is if there was a function in the Workspace, under the menu for each branch, which would 'unapply' any branches stacked above that branch and grey them out in Gitbutler.
|-
Feature 4|-
Feature 3|- Feature 2
|- Feature 1
Could be called 'Unapply branches above' or some such thing. You could then have a button on that branch to reapply the ones above it.
As it stands the workaround is basically not to use GitButler if my change is sufficiently complex that I know it will need a stacked PR chain, or to make my changes in GitButler and then checkout the branch outside of GB to test it,
All reactions