Skip to content

Commit

Permalink
faq: add entry about accidentally amended working copy
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonz committed Sep 8, 2023
1 parent 89e5cbd commit 1c8d27d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1c8d27d

Please sign in to comment.