jj icon indicating copy to clipboard operation
jj copied to clipboard

FR: `jj restore` should target multiple revisions

Open bonsairobo opened this issue 1 month ago • 0 comments

Is your feature request related to a problem? Please describe.

I'd like to easily strip changes to a file set from my branch. I was hoping that this command would work:

jj restore -f $BASE -t $BASE..$BRANCH_HEAD 'glob:"**/Cargo.lock"'

But it gives me this error:

Error: Revset `$BASE..$BRANCH_HEAD` resolved to more than one revision

Describe the solution you'd like

I want the same behavior of jj restore to be applied to all of the revisions that I provide in the -t revset.

Describe alternatives you've considered

Right now my workaround is this bash script:

BASE=$1
BRANCH=$2

BRANCH_CHANGE_IDS=$(jj log --no-graph -r "$BASE..$BRANCH" --template 'change_id ++ "\n"')

echo "$BRANCH_CHANGE_IDS" | tac | while IFS= read -r CHANGE_ID; do
    jj restore -f $BASE -t $CHANGE_ID 'glob:"**/Cargo.lock"'
done

bonsairobo avatar Oct 27 '25 07:10 bonsairobo