docs: make technical conflicts doc better match our recent thinking

These days, we usually think of conflicts as one base state and series
of diffs between other states. The base state is normally the parent
when rebasing.

Also, we're deprecated `jj backout` in favor of `jj revert`, so let's
use that terminology.
This commit is contained in:
Martin von Zweigbergk 2025-04-24 13:02:49 -07:00
parent 146900a071
commit 92629ded4c

View File

@ -49,17 +49,17 @@ simplify by removing canceling terms. These two steps are implemented in
`Merge::flatten()` and `Merge::simplify()` in [`merge.rs`][merge-rs]. `Merge::flatten()` and `Merge::simplify()` in [`merge.rs`][merge-rs].
For example, let's say commit B is based on A and is rebased to C, where it For example, let's say commit B is based on A and is rebased to C, where it
results in conflicts (`B+C-A`), which the user leaves unresolved. If the commit results in conflicts (`C+(B-A)`), which the user leaves unresolved. If the
is then rebased to D, the result will be `(B+C-A)+(D-C)` (`D-C` comes from commit is then rebased to D, the result will be `D+((C+(B-A))-C)`. That expression
changing the base from C to D). That expression can be simplified to `B+D-A`, can be simplified to `D+(B-A)`, which is a regular 3-way merge between D and B
which is a regular 3-way merge between B and D with A as base (no trace of C). with A as base (no trace of C). This is what lets the user keep old commits
This is what lets the user keep old commits rebased to head without resolving rebased to head without resolving conflicts and still not get messy recursive
conflicts and still not get messy recursive conflicts. conflicts.
As another example, let's go through what happens when you back out a conflicted As another example, let's go through what happens when you back out a conflicted
commit. Let's say we have the usual `B+C-A` conflict on top of non-conflict commit. Let's say we have the usual `C+(B-A)` conflict on top of non-conflict
state C. We then back out that change. Backing out ("reverting" in Git-speak) a state C. We then revert that change. Reverting a change means applying its
change means applying its reverse diff, so the result is `(B+C-A)+(A-(B+C-A))`, reverse diff, so the result is `(C+(B-A))+(A-(C+(B-A)))`, which we can simplify
which we can simplify to just `A` (i.e. no conflict). to just `A` (i.e. no conflict).
[merge-rs]: https://github.com/jj-vcs/jj/blob/main/lib/src/merge.rs [merge-rs]: https://github.com/jj-vcs/jj/blob/main/lib/src/merge.rs