One-step solution to moving change from commit to a new branch off main / other arbitrary point? #7053
-
Hey! Is it possible to move parts of a commit onto a different branch in a single command or without having to look up revisions? Or asked differently: can I squash into a new commit at an arbitrary destination? Lemme explain what I'm looking for with an example. For context: I'm using jj in a colocated git repo. Say I'm working on a branch A, which comes off of branch B (typically I'm using the "squash workflow", so I've got a commit with a message in
But while working on @, I find something that doesn't really belong to the task I'm working on, but that I would like to fix. Could be a typo, unused imports, unused code, etc. Because it doesn't belong to my current change, I'd like to make the changes but instead of squashing them into Is there an easy way to achieve this? I've looked up the docs for WorkaroundsOf course, there are workarounds, but I haven't found any that are as convenient. The most obvious to me, and the one that achieves what I want (if I understand correctly) is:
But I would like to not have to read off the prefix, and ideally do it in one command. In some cases, you could probably also rebase I'm sure there's other ways to do it, but I'm not sure how. I could probably make an alias that does this somehow, but I'm not sure exactly how (still pretty new to jj), so any tips would also be appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Have you looked at |
Beta Was this translation helpful? Give feedback.
Have you looked at
split
? Along with the--interactive
option, it has--insert-after
,--insert-before
, and--parallel
. You still have to be able to tell it where.