Can you jj split a "branch"? ~ Extracting specific changes from a branch / series of commits/revsets ~
#9038
Unanswered
thomasheartman
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm wondering whether there's an easy way to extract either all changes belonging to a specific file, or only specific changes since a starting point. I think that in essence, I'm looking for something like
jj split, except instead of splitting a single revision, I'd like to split all changes since a start point, typically main. Sort of as if you "flatten" all revisions only for the split command. Is that possible?In short, the problem I'm trying to solve is that when I get to the PR stage and review my own changes, I realize that some of them are unrelated and should be in a separate PR or that some changes should be extracted into another commit before the current branch so that I can make two more concise and easy-to grasp PRs.
For instance:
You're working on some changes, and for some reason you split it up into multiple commits. This could either be because that's your preferred workflow or because there's other people contributing to the branch, or because you want to split a stream of work into multiple PRs.
At the end, however, you realize that "oh, these changes in file F are orthogonal to this stream of work and can be branched off to trunk as their own separate PR". But you've made changes to them going throughout the commits (or you can't remember which commit introduced the changes).
What's the easiest way to achieve this? I suppose you could squash all the commits after trunk together (is there an easy way to "flatten" multiple commits like that?) and then split that?
There's also something like:
jj squash -i -f 'trunk()++::@' -t <new base commit>(there's probably a better way of writing that too?)However, then you're forced to go through each commit on its own, which is a bit unfortunate, I think.
Beta Was this translation helpful? Give feedback.
All reactions