diff --git a/docs/FAQ.md b/docs/FAQ.md index db4e10fecb..8c9300e45e 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -94,6 +94,17 @@ You'll then need to use `jj new --before` to create new commits and `jj move --to` to move new changes into the correct commits. +### I accidentally amended the working copy. How do I move the new changes into its own commit? + +Use `jj obslog -p` to see how your working-copy commit has evolved. Find the +commit you want to restore the contents to. Let's say the current commit (with +the changes intended for a new commit) are in commit X and the state you wanted +is in commit Y. Note the commit id (normally in blue at the end of the line in +the log output) of each of them. Now use `jj new` to create a new working-copy +commit, then run `jj restore --from Y --to @-` to restore the parent commit +to the old state, and `jj restore --from X` to restore the new working-copy +commit to the new state. + [config]: config.md [gitignore]: https://git-scm.com/docs/gitignore