←back to thread

Jujutsu for everyone

(jj-for-everyone.github.io)
434 points Bogdanp | 1 comments | | HN request time: 0s | source
Show context
zamalek ◴[] No.45084963[source]
I'm a through-and-through JJ convert. One papercut I have experienced a few times (though I am getting much better at avoiding) is what to do when I forget to `jj new`. Assuming that I have pushed the current bookmark to the remote, is there any way to recover a new change that is the diff against the remote? I have tried rebasing, but that leads to bookmark ambiguity instead of the solution I'm looking for.
replies(5): >>45084985 #>>45085090 #>>45085256 #>>45085704 #>>45085910 #
abound ◴[] No.45085256[source]
There's a few different ways to fix this, but here's what the official docs suggest: https://jj-vcs.github.io/jj/latest/FAQ/#i-accidentally-chang...

TL;DR - `jj evolog` and then restore changes from the relevant secret commit ID

replies(2): >>45085537 #>>45086931 #
zamalek ◴[] No.45085537[source]
But that would undo what I've done, right? I Wang to keep the changes but only diff them against what I've pushed.
replies(2): >>45085852 #>>45086170 #
1. dzaima ◴[] No.45085852[source]
You can do a `jj new; jj restore --restore-descendants -f commit_id -t @-` with a commit id (not change id!) from the evolog to "inject" a snapshot from the evolog below your current @, leaving the file state at @ (and everywhere else in the log) intact.

Or if you have a commit ID (or otherwise revset; so a "main@origin" or whatever would work) of a specific commit that you want already, can use that instead of course too.