LinuxCommandLibrary

jj-resolve

Resolve Jujutsu commit divergences

TLDR

Resolve all conflicts

$ jj resolve
copy

List all conflicts
$ jj resolve [[-l|--list]]
copy

Resolve conflicts in a given revision
$ jj resolve [[-r|--revision]] [revset]
copy

Resolve conflicts in given files
$ jj resolve [file1 file2 ...]
copy

Resolve accepting the incoming versions
$ jj resolve --tool :theirs
copy

Resolve accepting the outgoing versions
$ jj resolve --tool :ours
copy

SYNOPSIS

jj resolve [OPTIONS] [REV]...

PARAMETERS

--tool <NAME>
    Specifies an external merge tool to use for interactive conflict resolution. Examples include kdiff3, meld, or vimdiff. This overrides the default tool configured in jj's settings (e.g., ui.merge-tool).

--edit
    Forces the invocation of the configured merge tool for all non-trivial conflicts, even if a default resolution (e.g., all changes from one side) could have been applied automatically. This ensures an interactive review of all conflicting sections.

--revert
    Reverts a previous resolution, marking the specified conflicts as unresolved again. This is useful if a resolution was incorrect or needs to be redone.

--dry-run
    Performs a simulation of the resolution process without making any actual changes to the repository. It reports what actions would be taken, which is useful for previewing outcomes.

DESCRIPTION

The jj-resolve command is an integral part of the Jujutsu (jj) version control system, designed to handle conflicts that arise during operations like merging or rebasing. When jj encounters divergent changes that cannot be automatically reconciled, it creates a conflict, and jj-resolve is used to guide the resolution process.

By default, if no specific revision (REV) is provided, jj-resolve operates on the conflicts present in the current working-copy commit. This command updates the content of the affected commit(s) with the resolved version. Once a conflict is successfully resolved, jj-resolve marks it as such within the commit graph, indicating that the conflict no longer exists for that specific commit.

Users can interactively resolve conflicts by invoking an external merge tool, which can be configured via jj's settings. The command also provides options to force the use of a merge tool even for trivial conflicts, or to revert a previous resolution, effectively re-introducing the conflict state. The status of conflicts can always be checked using the jj-status command.

CAVEATS

jj-resolve fundamentally relies on the presence of conflicts. If no conflicts exist in the specified or implied commits, the command will indicate that there's nothing to resolve. For interactive resolution, a properly configured external merge tool is essential; an unconfigured or improperly working tool will prevent interactive resolution. This command resolves conflicts at the commit level, updating the content, but does not alter the commit history or create new commits automatically.

TYPICAL WORKFLOW

A common workflow involving jj-resolve starts after an operation like jj-merge or jj-rebase introduces conflicts. The user would first run jj-status to identify unresolved conflicts. Then, jj-resolve is used, often with an interactive tool, to fix the conflicting sections. After resolution, jj-status can be re-run to confirm that the conflicts are gone and the commit is clean.

HISTORY

The jj-resolve command is a core component of Jujutsu (jj), a modern, user-friendly version control system designed to address some of the complexities and limitations of traditional VCS like Git. It was developed as part of the initial design of jj to provide a robust and intuitive way to manage and resolve conflicts that arise naturally in collaborative development workflows, leveraging jj's unique approach to commit immutability and rebasability.

SEE ALSO

jj-status(1), jj-diff(1), jj-merge(1), jj-undo(1)

Copied to clipboard