Skip to content

Commit

Permalink
docs: add FAQ for why to use new-then-amend over edit
Browse files Browse the repository at this point in the history
  • Loading branch information
khionu committed Mar 7, 2024
1 parent 75c3b0c commit 07d84c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/src/commands/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ use crate::ui::Ui;
///
/// Note, it is generally recommended to instead to use `jj new` and `jj amend`. Creating
/// a new revision enables being more intentional with respect to the existing revision.
///
/// For more information, see https://github.com/martinvonz/jj/blob/main/docs/FAQ.md#how-do-i-resume-working-on-an-existing-change
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct EditArgs {
/// The commit to edit
Expand Down
11 changes: 11 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ 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.

### How do I resume working on an existing change?

There are two ways to resume working on an earlier change: `jj new` then `jj amend`,
and `jj edit`. The first is generally recommended over the second for a few reasons,
which come down to how intentional you are with your changes. If the revision you
want to resume working on has a conflict, `jj edit` would restore the state with
plain-text conflict annotations. Editing those annotations incorrectly or by
accident can lead to undesired output from conflict resolution. If you amend a new
revision onto a revision that contains a conflict, the conflict will be updated to
correctly reflect your new changes.

### How do I deal with divergent changes ('??' after the [change ID])?

A [divergent change][glossary_divergent_change] represents a change that has two
Expand Down

0 comments on commit 07d84c2

Please sign in to comment.