git-replay - Linux


git-replay replays a recorded Git history as a series of new commits, creating a new history that diverges from the original. This is useful for experimentation or reconstructing a sequence of commits based on a recorded history.


git replay [<options>] <recorded-history> [<target>]


-a, –auto-squash
Automatically squash commits with identical contents.

-c, –continue
Continue replaying from the last commit even if it was already replayed.

-d, –dry-run
Print what would be done without actually replaying.

-f, –force
Skip checks for conflicts and potentially dangerous operations.

-F, –fixup
Mark replayed commits as fixup commits.

-m, –message
Specify a commit message for replayed commits.

-p, –patch
Replay the recorded history as a patch series.

-q, –quiet
Suppress all output except errors.

Recreate missing parents for replayed commits.

-s, –signoff
Sign-off replayed commits.

-t, –target
Specify a branch or commit to replay the history onto.


Basic usage: Replay the recorded history in the file history.git onto the main branch:

git replay -t main history.git

Advanced usage: Replay the recorded history as a patch series and mark replayed commits as fixup commits:

git replay -p -F recorded-history.git origin/main

Common Issues

Conflicts during replay: Resolve conflicts manually or use the --force option at your own risk.

Incorrect history: Ensure the recorded history is valid and matches the target branch.


Using scripts: Create scripts that automate the replay process for specific scenarios.

Combining with other Git commands: Integrate git-replay into larger workflows involving cherry-picking, rebasing, or merging.

Related Commands

  • git-cherry-pick
  • git-rebase