From 0db5b0060615800bbf49df480bd273cb3813c231 Mon Sep 17 00:00:00 2001 From: jyn Date: Tue, 6 Feb 2024 21:09:33 -0500 Subject: [PATCH] document the jj equivalent of git reset --soft MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- docs/git-comparison.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/git-comparison.md b/docs/git-comparison.md index d998196cac..9c8635b86a 100644 --- a/docs/git-comparison.md +++ b/docs/git-comparison.md @@ -211,6 +211,11 @@ parent. git reset --hard (same as abandoning a change since Git has no concept of a "change") + + Abandon the parent of the working copy, but keep its diff in the working copy + jj move --from @- + git reset --soft HEAD~ + Discard working copy changes in some files jj restore <paths>...