jj pick out files from working copy

If you have a subset of files in your working copy you would like to pull out into a separate commit, you can use jj split -i to interactively select which files to do that with.

Let’s say you run jj st and see some files you’d like to pull out. For example, you’re working on Feature A but at some point you did some work for Feature N.

Whatever files associated with Feature N can be pulled out of the working copy and added to a new commit by using the split command.

I like to use jj split -i (the -i means interactive) to use the interactive file selector. This lets me select which files I want to “pull out” of the working copy.

So I’ll run jj split i, select the files that don’t belong in the current working copy, and then hit c (or click the File->Confirm TUI menu options). This prompts the commit message editor to pop up. You’ll see the description of the current working copy pre-populated. I will delete that, and replace it with a message the describes the work for Feature N that I am picking out of the working copy.

When you save that message, you’ll then have an opportunity to edit the current working copy message. I simply close the editor, which sets up my repo exactly how I want it: the files that should belong to Feature N have been pulled out of the working copy and added to a new commit that is now the parent commit of the working copy.