ok/jj
1
0
Fork 0
forked from mirrors/jj

faq: add entry about accidentally amended working copy

This commit is contained in:
Martin von Zweigbergk 2023-09-08 08:29:21 -07:00 committed by Martin von Zweigbergk
parent 89e5cbd6ef
commit 1c8d27dc39

View file

@ -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