forked from mirrors/jj
document the jj equivalent of git reset --soft
i did the following things: 1. make some changes to the working copy 2. run `jj commit` 3. before i added a description, i decided i didn't want to commit yet. in git, the way to do this is to delete the contents of the editor; git sees that it is blank and aborts the commit. in jj, this doesn't work, because descriptions are allowed to be empty. now i have the following jj state: ``` ; jj log --stat @ pokrsyvs github@jyn.dev 2024-02-06 21:48:17.000 -05:00 ddd6217f │ (empty) (no description set) │ 0 files changed, 0 insertions(+), 0 deletions(-) ◉ lqqmzmku github@jyn.dev 2024-02-06 21:48:02.000 -05:00 HEAD@git b03bf3de │ (no description set) │ config/jj.toml | 2 +- │ 1 file changed, 1 insertion(+), 1 deletion(-) ◉ xqkmwvwp github@jyn.dev 2024-02-06 21:47:08.000 -05:00 master b673f97b ``` i want to undo the most recent commit, `lqqmzmku`. i'm used to doing this with `git reset --soft HEAD~`, which makes the parent `xqkmwvwp` and leaves the change to `config/jj.toml` on disk while removing it from the git history; basically `lqqmzmku` would go back to being the working copy. i found that `jj move` does what i want, but it took a lot of trawling the options, it wasn't obvious, and i couldn't find `git reset` mentioned in the docs.
This commit is contained in:
parent
785f2f5776
commit
bca905a26e
1 changed files with 5 additions and 0 deletions
|
@ -211,6 +211,11 @@ parent.
|
||||||
<td><code>git reset --hard</code> (same as abandoning a change since Git
|
<td><code>git reset --hard</code> (same as abandoning a change since Git
|
||||||
has no concept of a "change")</td>
|
has no concept of a "change")</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Abandon the parent of the working copy, but keep its diff in the working copy</td>
|
||||||
|
<td><code>jj move --from @-</code></td>
|
||||||
|
<td><code>git reset --soft HEAD~</code></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Discard working copy changes in some files</td>
|
<td>Discard working copy changes in some files</td>
|
||||||
<td><code>jj restore <paths>...</code></td>
|
<td><code>jj restore <paths>...</code></td>
|
||||||
|
|
Loading…
Reference in a new issue