Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.32 KB

File metadata and controls

31 lines (23 loc) · 1.32 KB

Squash Changes Into Parent Commit Interactively

While I have some changes in progress as part of the working copy, I can squash them into the previous / parent commit with the jj squash command. Running that command as is will apply all the working copy changes to the parent leaving the current revision empty.

I can also interactively squash those changes similar in spirit to how I might use git add --patch to stage and then amend specific changes into the previous commit with git. This can be done with jj using squash with the -i flag.

jj squash -i # or --interactive

This will open up a TUI where I can click around or use keys. Each file in the source revision (in my case, the working copy) will be listed. I can move the cursor between them hitting space to toggle them in or out of the squash selection.

I can also hit f over a given file to toggle folding. When folding is on, a diff of the file will be disclosed with checkboxes for toggling individual hunks and lines.

Once I'm satisfied with my interactive selection, I can hit c to confirm and only the selected files and changes will be squashed into the parent.

See man jj-squash for more details.

source