Unsquashing from a merge commit is weird #4343
-
Say you've got a merge commit. ; jj new knx ttl
; jj log
@ qqyvktys [email protected] 2024-08-26 12:24:32 76ca4eb8
├─╮ (empty) (no description set)
│ ○ ttlomumr [email protected] 2024-08-26 11:29:21 ffbaeec4
│ │ add CONTRIBUTING.md
○ │ knxrzpxl [email protected] 2024-08-26 11:30:01 dfa6e45f
├─╯ add README.md
◆ zzzzzzzz root() 00000000 Then, you make some changes: ; echo 'fn main() {}' > main.rs
; jj log
@ qqyvktys [email protected] 2024-08-26 12:26:21 0f41bee4
├─╮ (no description set)
│ ○ ttlomumr [email protected] 2024-08-26 11:29:21 ffbaeec4
│ │ add CONTRIBUTING.md
○ │ knxrzpxl [email protected] 2024-08-26 11:30:01 dfa6e45f
├─╯ add README.md
◆ zzzzzzzz root() 00000000 Often at this point I realise I didn't want to do the work in the merge commit, since there were no conflicts to resolve or warnings/formatting issues to fix up during the merge, rather this was new work. As a habit it's better to There is no way to ; jj new
; jj unsquash
; jj log
@ womzqlzp [email protected] 2024-08-26 12:32:55 a2592df4
├─╮ (no description set)
│ ○ ttlomumr [email protected] 2024-08-26 11:29:21 ffbaeec4
│ │ add CONTRIBUTING.md
○ │ knxrzpxl [email protected] 2024-08-26 11:30:01 dfa6e45f
├─╯ add README.md
◆ zzzzzzzz root() 00000000 Basically qqy was "empty" after we took all the changes, so it got abandoned, and we end up with a new merge commit that's exactly the same as before. The current behaviour is a bit surprising to me because I don't really think of the parents of a commit as being "changes" that you can move around. Not sure what the right path forward is for this. Maybe merge commits should not be empty for unsquash purposes? Or maybe there should be an Also, it would be nice if ; jj split --invert # basically inserts an empty commit before rev, doesn't go into interactive mode
; jj split --invert PATHS # puts PATHS in the first commit instead |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think you can EDIT: Add |
Beta Was this translation helpful? Give feedback.
I think you can
jj new --before qq
to insert a new commit beforeqq
. It should become a merge commit because it inherits the parents ofqq
by default (you could combine it with--after
, but that's not what you're looking for in your case).EDIT: Add
--no-edit
to just create the commit without editing it afterwards.