builtin/history: rename "--ref-action=" to "--update-refs="
With the preceding commit we have changed "--ref-action=" to only control which refs are supposed to be updated, not what happens with them. As a consequence, the option is now somewhat misnamed, as we don't control the action itself anymore. Rename it to "--update-refs=" to better align it with its new use. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Feb 16, 2026 at 07:45 UTC
060e602dcb4ce94cd57ccdc4256a136fc36d9c40
3 files changed
+10
-10
Documentation/git-history.adoc
+2
-2
@@ -8,7 +8,7 @@ git-history - EXPERIMENTAL: Rewrite history
8
SYNOPSIS
9
--------
10
[synopsis]
11
-git history reword <commit> [--dry-run] [--ref-action=(branches|head)]
11
+git history reword <commit> [--dry-run] [--update-refs=(branches|head)]
12
13
DESCRIPTION
14
-----------
@@ -66,7 +66,7 @@ OPTIONS
66
objects will be written into the repository, so applying these printed
67
ref updates is generally safe.
68
69
-`--ref-action=(branches|head)`::
69
+`--update-refs=(branches|head)`::
70
Control which references will be updated by the command, if any. With
71
`branches`, all local branches that point to commits which are
72
descendants of the original commit will be rewritten. With `head`, only
builtin/history.c
+4
-4
@@ -18,7 +18,7 @@
18
#include "wt-status.h"
19
20
#define GIT_HISTORY_REWORD_USAGE \
21
- N_("git history reword <commit> [--dry-run] [--ref-action=(branches|head)]")
21
+ N_("git history reword <commit> [--dry-run] [--update-refs=(branches|head)]")
22
23
static void change_data_free(void *util, const char *str UNUSED)
24
{
@@ -258,7 +258,7 @@ static int setup_revwalk(struct repository *repo,
258
goto out;
259
} else if (!ret) {
260
ret = error(_("rewritten commit must be an ancestor "
261
- "of HEAD when using --ref-action=head"));
261
+ "of HEAD when using --update-refs=head"));
262
goto out;
263
}
264
@@ -416,8 +416,8 @@ static int cmd_history_reword(int argc,
416
enum ref_action action = REF_ACTION_DEFAULT;
417
int dry_run = 0;
418
struct option options[] = {
419
- OPT_CALLBACK_F(0, "ref-action", &action, N_("<action>"),
420
- N_("control ref update behavior (branches|head)"),
419
+ OPT_CALLBACK_F(0, "update-refs", &action, N_("<action>"),
420
+ N_("control which refs should be updated (branches|head)"),
421
PARSE_OPT_NONEG, parse_ref_action),
422
OPT_BOOL('n', "dry-run", &dry_run,
423
N_("perform a dry-run without updating any refs")),
t/t3451-history-reword.sh
+4
-4
@@ -233,7 +233,7 @@ test_expect_success '--dry-run prints ref updates without modifying repo' '
233
test_commit theirs &&
234
235
git refs list >refs-expect &&
236
- reword_with_message --dry-run --ref-action=head base >updates <<-\EOF &&
236
+ reword_with_message --dry-run --update-refs=head base >updates <<-\EOF &&
237
reworded commit
238
EOF
239
git refs list >refs-actual &&
@@ -258,7 +258,7 @@ test_expect_success '--dry-run prints ref updates without modifying repo' '
258
)
259
'
260
261
-test_expect_success '--ref-action=head updates only HEAD' '
261
+test_expect_success '--update-refs=head updates only HEAD' '
262
test_when_finished "rm -rf repo" &&
263
git init repo --initial-branch=main &&
264
(
@@ -271,10 +271,10 @@ test_expect_success '--ref-action=head updates only HEAD' '
271
272
# When told to update HEAD, only, the command will refuse to
273
# rewrite commits that are not an ancestor of HEAD.
274
- test_must_fail git -c core.editor=false history reword --ref-action=head theirs 2>err &&
274
+ test_must_fail git -c core.editor=false history reword --update-refs=head theirs 2>err &&
275
test_grep "rewritten commit must be an ancestor of HEAD" err &&
276
277
- reword_with_message --ref-action=head base >updates <<-\EOF &&
277
+ reword_with_message --update-refs=head base >updates <<-\EOF &&
278
reworded base
279
EOF
280
expect_log HEAD <<-\EOF &&