LinuxCommandLibrary

jj-simplify-parents

Simplify commit parents

TLDR

Simplify parent edges of given revisions

$ jj simplify-parents [[-r|--revisions]] [revsets]
copy

Simplify parent edges of given revisions and trees of their descendants
$ jj simplify-parents [[-s|--source]] [revsets]
copy

SYNOPSIS

jj simplify-parents [OPTION]... [REVISION]...

PARAMETERS

-r, --revision <REVISION>
    Specifies one or more revisions whose parents should be simplified. This option can be used multiple times to target several commits. If no revisions are provided, the command operates on the working copy's current commit.

-p, --parent <REVISION>
    Defines a specific parent revision to consider for removal. This option can be specified multiple times. If provided, only these specified parents are checked for redundancy and potentially removed. If not specified, the command automatically identifies and removes all redundant parents.

DESCRIPTION

The jj simplify-parents command is a powerful tool within the Jujutsu (jj) version control system designed to clean up and simplify the parent structure of commits. It identifies and removes redundant merge parents from commits, where a parent is considered redundant if it is an ancestor of another parent of the same commit. This often occurs in scenarios like merging a branch back into its ancestor, leading to unnecessarily complex and cluttered commit graphs.

While this command rewrites the specified commits, it guarantees that the commit's content (the 'tree') remains unchanged. Its primary purpose is to make the commit history cleaner and easier to understand without altering the functional state of the code. It helps in maintaining a tidy and linear-looking history, which can improve readability and simplify operations that traverse the commit graph. By default, if no revisions are specified, it operates on the working copy's commit.

CAVEATS

Using jj simplify-parents rewrites the history of the specified commits, meaning their commit IDs will change. While the command preserves the commit's content (tree), any operations or references that rely on the old commit IDs (e.g., external tools, bookmarks, or scripts) will need to be updated. It's generally recommended to use this command with caution, especially on shared history, and to communicate changes to collaborators if the affected commits have been published.

JUJUTSU (JJ) CONTEXT

The command jj simplify-parents is a subcommand of the Jujutsu (jj) version control system, not a standalone Linux command named jj-simplify-parents. To execute it, you must have Jujutsu installed and invoke it via the jj executable, followed by the subcommand name.

HISTORY

The simplify-parents subcommand is an integral part of the Jujutsu (jj) version control system, which was designed from the ground up to address common complexities and frustrations found in traditional VCS like Git. Introduced early in jj's development, it embodies jj's philosophy of offering powerful, intuitive tools for manipulating and cleaning up commit history. It specifically targets the common issue of redundant merge parents, a problem that often arises in Git when merging branches that have already converged or been rebased, leading to an unnecessarily bushy and confusing commit graph. This command provides a clean solution without altering the committed code.

SEE ALSO

jj rebase(1), jj squash(1), jj obslog(1), git rebase(1)

Copied to clipboard