git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 12/12] builtin/rerere: introduce proper usage strings for subcommands

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 27, 2026, 10:46 UTC
Message-ID
<20261027-pks-rerere-subcommands-v1-12-d836c36ce0c5@pks.im>
In-Reply-To
<20261027-pks-rerere-subcommands-v1-0-d836c36ce0c5@pks.im>

Adapt git-rerere(1) to have proper usage strings for each of the subcommands.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/git-rerere.adoc |  8 +++++-
 builtin/rerere.c              | 61 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 58 insertions(+), 11 deletions(-)
diff --git a/Documentation/git-rerere.adoc b/Documentation/git-rerere.adoc
index 4e6ab9a27c9..e04e9ef3ef8 100644
--- a/Documentation/git-rerere.adoc
+++ b/Documentation/git-rerere.adoc
@@ -8,7 +8,13 @@ git-rerere - Reuse recorded resolution of conflicted merges
 SYNOPSIS
 --------
 [verse]
-'git rerere' [clear | forget <pathspec>... | diff | status | remaining | gc]
+'git rerere' [--[no-]rerere-autoupdate]
+'git rerere' clear
+'git rerere' diff
+'git rerere' forget <pathspec>...
+'git rerere' gc
+'git rerere' remaining
+'git rerere' status
 
 DESCRIPTION
 -----------
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 80ecca1fe0d..97a08ecd6e7 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -10,10 +10,13 @@
 #include "xdiff-interface.h"
 #include "pathspec.h"
 
-static const char * const rerere_usage[] = {
-	N_("git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"),
-	NULL,
-};
+#define RERERE_USAGE N_("git rerere [--[no-]rerere-autoupdate]")
+#define RERERE_CLEAR_USAGE N_("git rerere clear")
+#define RERERE_DIFF_USAGE N_("git rerere diff")
+#define RERERE_FORGET_USAGE N_("git rerere forget <pathspec>...")
+#define RERERE_GC_USAGE N_("git rerere gc")
+#define RERERE_REMAINING_USAGE N_("git rerere remaining")
+#define RERERE_STATUS_USAGE N_("git rerere status")
 
 static int outf(void *dummy UNUSED, mmfile_t *ptr, int nbuf)
 {
@@ -61,9 +64,13 @@ static int cmd_rerere_clear(int argc,
 	struct option options[] = {
 		OPT_END(),
 	};
+	const char * const rerere_clear_usage[] = {
+		RERERE_CLEAR_USAGE,
+		NULL,
+	};
 	struct string_list merge_rr = STRING_LIST_INIT_DUP;
 
-	argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
+	argc = parse_options(argc, argv, prefix, options, rerere_clear_usage, 0);
 	if (argc)
 		usage(_("too many arguments"));
 
@@ -81,11 +88,15 @@ static int cmd_rerere_diff(int argc,
 	struct option options[] = {
 		OPT_END(),
 	};
+	const char * const rerere_diff_usage[] = {
+		RERERE_DIFF_USAGE,
+		NULL,
+	};
 	struct string_list merge_rr = STRING_LIST_INIT_DUP;
 	struct strbuf buf = STRBUF_INIT;
 	struct rerere_cache cache;
 
-	argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
+	argc = parse_options(argc, argv, prefix, options, rerere_diff_usage, 0);
 	if (argc)
 		usage(_("too many arguments"));
 
@@ -115,10 +126,14 @@ static int cmd_rerere_forget(int argc,
 	struct option options[] = {
 		OPT_END(),
 	};
+	const char * const rerere_forget_usage[] = {
+		RERERE_FORGET_USAGE,
+		NULL,
+	};
 	struct pathspec pathspec;
 	int ret;
 
-	argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
+	argc = parse_options(argc, argv, prefix, options, rerere_forget_usage, 0);
 	if (!argc)
 		warning(_("'git rerere forget' without paths is deprecated"));
 	parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_CWD, prefix, argv);
@@ -140,9 +155,13 @@ static int cmd_rerere_gc(int argc,
 				N_("skip gc while another process holds the lock")),
 		OPT_END(),
 	};
+	const char * const rerere_gc_usage[] = {
+		RERERE_GC_USAGE,
+		NULL,
+	};
 	struct string_list merge_rr = STRING_LIST_INIT_DUP;
 
-	argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
+	argc = parse_options(argc, argv, prefix, options, rerere_gc_usage, 0);
 	if (argc)
 		usage(_("too many arguments"));
 
@@ -164,6 +183,10 @@ static int cmd_rerere_record(int argc,
 			N_("register clean resolutions in index"), 1),
 		OPT_END(),
 	};
+	const char * const rerere_usage[] = {
+		RERERE_USAGE,
+		NULL,
+	};
 	enum rerere_flags flags = 0;
 
 	argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
@@ -186,9 +209,13 @@ static int cmd_rerere_remaining(int argc,
 	struct option options[] = {
 		OPT_END(),
 	};
+	const char * const rerere_remaining_usage[] = {
+		RERERE_REMAINING_USAGE,
+		NULL,
+	};
 	struct string_list merge_rr = STRING_LIST_INIT_DUP;
 
-	argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
+	argc = parse_options(argc, argv, prefix, options, rerere_remaining_usage, 0);
 	if (argc)
 		usage(_("too many arguments"));
 
@@ -214,10 +241,14 @@ static int cmd_rerere_status(int argc,
 	struct option options[] = {
 		OPT_END(),
 	};
+	const char * const rerere_status_usage[] = {
+		RERERE_STATUS_USAGE,
+		NULL,
+	};
 	struct string_list merge_rr = STRING_LIST_INIT_DUP;
 	struct rerere_cache cache;
 
-	argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
+	argc = parse_options(argc, argv, prefix, options, rerere_status_usage, 0);
 	if (argc)
 		usage(_("too many arguments"));
 
@@ -247,6 +278,16 @@ int cmd_rerere(int argc,
 		OPT_SUBCOMMAND("status", &fn, cmd_rerere_status),
 		OPT_END(),
 	};
+	const char * const rerere_usage[] = {
+		RERERE_USAGE,
+		RERERE_CLEAR_USAGE,
+		RERERE_DIFF_USAGE,
+		RERERE_FORGET_USAGE,
+		RERERE_GC_USAGE,
+		RERERE_REMAINING_USAGE,
+		RERERE_STATUS_USAGE,
+		NULL,
+	};
 
 	argc = parse_options(argc, argv, prefix, options, rerere_usage,
 			     PARSE_OPT_KEEP_UNKNOWN_OPT | PARSE_OPT_SUBCOMMAND_OPTIONAL);
-- 
2.56.0.341.g393f52fd96.dirty
Previous: Patrick SteinhardtNext: Junio C Hamano
Message 21 of 89 in “builtin/rerere: convert to use subcommands”
  1. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Oct 27, 2026
  2. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Oct 27, 2026
  3. Junio C HamanoOct 27, 2026
  4. Patrick SteinhardtOct 28, 2026
  5. Junio C HamanoOct 28, 2026
  6. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Oct 27, 2026
  7. Mark C. Chu-CarrollOct 27, 2026
  8. Junio C HamanoOct 27, 2026
  9. Patrick SteinhardtOct 28, 2026
  10. Mark C. Chu-CarrollOct 28, 2026
  11. Junio C HamanoOct 28, 2026
  12. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Oct 27, 2026
  13. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Oct 27, 2026
  14. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  15. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  16. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  17. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  18. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  19. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  20. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Oct 27, 2026
  21. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Oct 27, 2026
  22. Junio C HamanoOct 27, 2026
  23. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Oct 29, 2026
  24. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Oct 29, 2026
  25. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Oct 29, 2026
  26. Karthik NayakNov 6, 2026
  27. Patrick SteinhardtNov 6, 2026
  28. Karthik NayakNov 6, 2026
  29. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Oct 29, 2026
  30. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Oct 29, 2026
  31. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  32. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  33. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  34. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  35. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  36. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  37. Karthik NayakNov 6, 2026
  38. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Oct 29, 2026
  39. Karthik NayakNov 6, 2026
  40. Patrick SteinhardtNov 6, 2026
  41. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Oct 29, 2026
  42. Karthik NayakNov 6, 2026
  43. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Nov 6, 2026
  44. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Nov 6, 2026
  45. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Nov 6, 2026
  46. Junio C HamanoNov 6, 2026
  47. Patrick SteinhardtNov 9, 2026
  48. Junio C HamanoNov 9, 2026
  49. Junio C HamanoNov 9, 2026
  50. Patrick SteinhardtNov 11, 2026
  51. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Nov 6, 2026
  52. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Nov 6, 2026
  53. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  54. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  55. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  56. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  57. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  58. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  59. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Nov 6, 2026
  60. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Nov 6, 2026
  61. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Nov 11, 2026
  62. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Nov 11, 2026
  63. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Nov 11, 2026
  64. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Nov 11, 2026
  65. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Nov 11, 2026
  66. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  67. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  68. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  69. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  70. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  71. Junio C HamanoNov 17, 2026
  72. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  73. Junio C HamanoNov 17, 2026
  74. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Nov 11, 2026
  75. Junio C HamanoNov 17, 2026
  76. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Nov 11, 2026
  77. Junio C HamanoNov 17, 2026
  78. Karthik NayakNov 12, 2026
  79. Patrick SteinhardtNov 13, 2026
  80. Junio C HamanoNov 13, 2026
  81. Tuomas AholaNov 13, 2026
  82. Phillip WoodNov 13, 2026
  83. Junio C HamanoNov 13, 2026
  84. Tuomas AholaNov 14, 2026
  85. Patrick SteinhardtNov 16, 2026
  86. Junio C HamanoNov 14, 2026
  87. Patrick SteinhardtNov 16, 2026
  88. Junio C HamanoNov 16, 2026
  89. Junio C HamanoNov 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.