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

Re: [PATCH v3 5/5] builtin/refs: add "rename" subcommand

From
Toon Claes <toon@iotcl.com>
Date
Jul 3, 2026, 14:31 UTC
Message-ID
<87o6go2lgt.fsf@emacs.iotcl.com>
In-Reply-To
<20260630-pks-refs-writing-subcommands-v3-5-deb04de1ecef@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 27 quoted lines
> Add a "rename" subcommand to git-refs(1) with the syntax:
>
>   $ git refs rename <oldref> <newref>
>
> It renames <oldref> together with its reflog to <newref>; even when used
> on a local branch ref, the current value and the reflog of the ref are
> the only things that are renamed. Document it and redirect casual users
> to "git branch -m" if that is what they wanted to do.
>
> Co-authored-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  Documentation/git-refs.adoc |   6 ++
>  builtin/refs.c              |  49 +++++++++++++++++
>  t/meson.build               |   1 +
>  t/t1467-refs-rename.sh      | 131 ++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 187 insertions(+)
>
> diff --git a/Documentation/git-refs.adoc b/Documentation/git-refs.adoc
> index e6a3528349..ce278c59bf 100644
> --- a/Documentation/git-refs.adoc
> +++ b/Documentation/git-refs.adoc
> @@ -23,6 +23,7 @@ git refs optimize [--all] [--no-prune] [--auto] [--include <pattern>] [--exclude
>  git refs create [--message=<reason>] [--no-deref] [--create-reflog] <ref> <new-value>
>  git refs delete [--message=<reason>] [--no-deref] <ref> [<old-value>]
>  git refs update [--message=<reason>] [--no-deref] [--create-reflog] <ref> <new-value> [<old-value>]
> +git refs rename [--message=<reason>] <old-ref> <new-ref>
So symrefs cannot be renamed with this command?
-- 
Cheers,
Toon
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 37 of 47 in “builtin/refs: add ability to write references”
  1. 0/4 builtin/refs: add ability to write referencesPatrick Steinhardt, Jun 16, 2026
  2. 1/4 builtin/refs: drop `the_repository`Patrick Steinhardt, Jun 16, 2026
  3. 2/4 builtin/refs: add "delete" subcommandPatrick Steinhardt, Jun 16, 2026
  4. 3/4 builtin/refs: add "update" subcommandPatrick Steinhardt, Jun 16, 2026
  5. Junio C HamanoJun 16, 2026
  6. Patrick SteinhardtJun 17, 2026
  7. Junio C HamanoJun 17, 2026
  8. Junio C HamanoJun 16, 2026
  9. Patrick SteinhardtJun 17, 2026
  10. 4/4 builtin/refs: add "rename" subcommandPatrick Steinhardt, Jun 16, 2026
  11. Junio C HamanoJun 16, 2026
  12. Patrick SteinhardtJun 17, 2026
  13. Junio C HamanoJun 17, 2026
  14. 0/5 builtin/refs: add ability to write referencesPatrick Steinhardt, Jun 17, 2026
  15. 1/5 builtin/refs: drop `the_repository`Patrick Steinhardt, Jun 17, 2026
  16. 2/5 builtin/refs: add "delete" subcommandPatrick Steinhardt, Jun 17, 2026
  17. 3/5 builtin/refs: add "update" subcommandPatrick Steinhardt, Jun 17, 2026
  18. 4/5 builtin/refs: add "create" subcommandPatrick Steinhardt, Jun 17, 2026
  19. Junio C HamanoJun 29, 2026
  20. Patrick SteinhardtJun 30, 2026
  21. 5/5 builtin/refs: add "rename" subcommandPatrick Steinhardt, Jun 17, 2026
  22. Junio C HamanoJun 17, 2026
  23. Junio C HamanoJun 29, 2026
  24. Patrick SteinhardtJun 30, 2026
  25. 0/5 builtin/refs: add ability to write referencesPatrick Steinhardt, Jun 30, 2026
  26. 1/5 builtin/refs: drop `the_repository`Patrick Steinhardt, Jun 30, 2026
  27. 2/5 builtin/refs: add "delete" subcommandPatrick Steinhardt, Jun 30, 2026
  28. Toon ClaesJul 3, 2026
  29. Patrick SteinhardtJul 3, 2026
  30. 3/5 builtin/refs: add "update" subcommandPatrick Steinhardt, Jun 30, 2026
  31. 4/5 builtin/refs: add "create" subcommandPatrick Steinhardt, Jun 30, 2026
  32. Toon ClaesJul 3, 2026
  33. Patrick SteinhardtJul 6, 2026
  34. Toon ClaesJul 9, 2026
  35. Toon ClaesJul 9, 2026
  36. 5/5 builtin/refs: add "rename" subcommandPatrick Steinhardt, Jun 30, 2026
  37. Toon ClaesJul 3, 2026
  38. Patrick SteinhardtJul 6, 2026
  39. Junio C HamanoJun 30, 2026
  40. 0/5 builtin/refs: add ability to write referencesPatrick Steinhardt, Jul 6, 2026
  41. 1/5 builtin/refs: drop `the_repository`Patrick Steinhardt, Jul 6, 2026
  42. 2/5 builtin/refs: add "delete" subcommandPatrick Steinhardt, Jul 6, 2026
  43. Toon ClaesJul 9, 2026
  44. 3/5 builtin/refs: add "update" subcommandPatrick Steinhardt, Jul 6, 2026
  45. 4/5 builtin/refs: add "create" subcommandPatrick Steinhardt, Jul 6, 2026
  46. 5/5 builtin/refs: add "rename" subcommandPatrick Steinhardt, Jul 6, 2026
  47. Junio C HamanoJul 6, 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.