Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Reference | 2025.1

# p4 graph rebase (graph)

Replay local history onto the target's new base.

For depots of type `graph` only.

## Syntax

    p4 graph rebase [-r ref ] [-f] --repo repo --target target source

Syntax conventions

## Description

Rebase moves the base of the target branch from its current location in the source to the source's HEAD. The source branch is not altered.

Rebase:

1. Determines the common base between the target and source, saving the local commits of the target branch committed after the base.
2. Resets the target branch HEAD to the source branch HEAD.
3. Applies the saved local changes as new commits on the target.

The target branch reference is updated to the last replayed commit.

Rebase requires `force-push` permissions. (See Permissions)

If conflicts are detected when replaying the diffs, the rebase fails, and any intermediary commits will be orphaned.

If the common base cannot be found, the rebase fails.

## Options

`--repo` | Specifies the repo.
`--target` | Specifies the branch reference whose history would be changed by rebasing its local changes onto its new base.
`-r` | Allows an alternative reference to be updated which can be tested without having updated the target. If the ref exists, `force-push` permissions are required. If the ref does not exist, `create-ref` permissions are required.
``-f`` | Required if the `--target` is the default branch of the repo.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | `list` protection, `force-push` permission

Your search for returned results