@@ -9,7 +9,8 @@ git-replay - EXPERIMENTAL: Replay commits on a new base, works with bare repos t
99SYNOPSIS
1010--------
1111[verse]
12- (EXPERIMENTAL!) 'git replay' ([-- contained] -- onto <newbase > | -- advance <branch > | -- revert <branch >) [-- ref-action[=<mode >]] <revision-range >
12+ (EXPERIMENTAL!) 'git replay' ([-- contained] -- onto=<newbase > | -- advance=<branch > | -- revert=<branch >)
13+ [-- ref=<ref >] [-- ref-action=<mode >] <revision-range >
1314
1415DESCRIPTION
1516-----------
@@ -26,23 +27,23 @@ THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
2627OPTIONS
2728-------
2829
29- -- onto <newbase >::
30+ -- onto= <newbase >::
3031 Starting point at which to create the new commits. May be any
3132 valid commit, and not just an existing branch name.
3233+
3334When `--onto` is specified, the branch(es) in the revision range will be
3435updated to point at the new commits, similar to the way `git rebase --update-refs`
3536updates multiple branches in the affected range.
3637
37- -- advance <branch >::
38+ -- advance= <branch >::
3839 Starting point at which to create the new commits; must be a
3940 branch name.
4041+
4142The history is replayed on top of the <branch > and <branch > is updated to
4243point at the tip of the resulting history. This is different from `--onto` ,
4344which uses the target only as a starting point without updating it.
4445
45- -- revert <branch >::
46+ -- revert= <branch >::
4647 Starting point at which to create the reverted commits; must be a
4748 branch name.
4849+
@@ -65,6 +66,16 @@ incompatible with `--contained` (which is a modifier for `--onto` only).
6566 Update all branches that point at commits in
6667 <revision-range >. Requires `--onto` .
6768
69+ -- ref=<ref >::
70+ Override which reference is updated with the result of the replay.
71+ The ref must be fully qualified.
72+ When used with `--onto` , the `<revision-range>` should have a
73+ single tip and only the specified reference is updated instead of
74+ inferring refs from the revision range.
75+ When used with `--advance` or `--revert` , the specified reference is
76+ updated instead of the branch given to those options.
77+ This option is incompatible with `--contained` .
78+
6879-- ref-action[=<mode >]::
6980 Control how references are updated. The mode can be:
7081+
@@ -79,8 +90,8 @@ The default mode can be configured via the `replay.refAction` configuration vari
7990
8091<revision-range >::
8192 Range of commits to replay; see "Specifying Ranges" in
82- linkgit:git-rev-parse[1]. In `--advance <branch>` or
83- `--revert <branch>` mode, the range should have a single tip,
93+ linkgit:git-rev-parse[1]. In `--advance= <branch>` or
94+ `--revert= <branch>` mode, the range should have a single tip,
8495 so that it's clear to which tip the advanced or reverted
8596 <branch > should point. Any commits in the range whose changes
8697 are already present in the branch the commits are being
@@ -127,22 +138,22 @@ EXAMPLES
127138To simply rebase `mybranch` onto `target`:
128139
129140------------
130- $ git replay --onto target origin/main..mybranch
141+ $ git replay --onto= target origin/main..mybranch
131142------------
132143
133144The refs are updated atomically and no output is produced on success.
134145
135146To see what would be updated without actually updating:
136147
137148------------
138- $ git replay --ref-action=print --onto target origin/main..mybranch
149+ $ git replay --ref-action=print --onto= target origin/main..mybranch
139150update refs/heads/mybranch ${NEW_mybranch_HASH} ${OLD_mybranch_HASH}
140151------------
141152
142153To cherry-pick the commits from mybranch onto target:
143154
144155------------
145- $ git replay --advance target origin/main..mybranch
156+ $ git replay --advance= target origin/main..mybranch
146157------------
147158
148159Note that the first two examples replay the exact same commits and on
@@ -154,7 +165,7 @@ What if you have a stack of branches, one depending upon another, and
154165you'd really like to rebase the whole set?
155166
156167------------
157- $ git replay --contained --onto origin/main origin/main..tipbranch
168+ $ git replay --contained --onto= origin/main origin/main..tipbranch
158169------------
159170
160171All three branches (`branch1`, `branch2`, and `tipbranch`) are updated
@@ -165,7 +176,7 @@ commits to replay using the syntax `A..B`; any range expression will
165176do:
166177
167178------------
168- $ git replay --onto origin/main ^base branch1 branch2 branch3
179+ $ git replay --onto= origin/main ^base branch1 branch2 branch3
169180------------
170181
171182This will simultaneously rebase `branch1`, `branch2`, and `branch3`,
@@ -176,7 +187,7 @@ that they have in common, but that does not need to be the case.
176187To revert commits on a branch:
177188
178189------------
179- $ git replay --revert main topic~2..topic
190+ $ git replay --revert= main topic~2..topic
180191------------
181192
182193This reverts the last two commits from `topic`, creating revert commits on
@@ -188,6 +199,16 @@ NOTE: For reverting an entire merge request as a single commit (rather than
188199commit-by-commit), consider using `git merge-tree --merge-base $TIP HEAD $BASE`
189200which can avoid unnecessary merge conflicts.
190201
202+ To replay onto a specific commit while updating a different reference:
203+
204+ ------------
205+ $ git replay --onto=112233 --ref=refs/heads/mybranch aabbcc..ddeeff
206+ ------------
207+
208+ This replays the range `aabbcc..ddeeff` onto commit `112233` and updates
209+ `refs/heads/mybranch` to point at the result. This can be useful when you want
210+ to use bare commit IDs instead of branch names.
211+
191212GIT
192213---
193214Part of the linkgit:git[1] suite
0 commit comments