]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/refs: add "rename" subcommand
authorPatrick Steinhardt <ps@pks.im>
Mon, 6 Jul 2026 13:27:08 +0000 (15:27 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Jul 2026 14:45:57 +0000 (07:45 -0700)
commit002fe677caddc8162949315c73e53422d4e0f4e8
tree35b3473d7490164f3de4380fe36e769ff1da2834
parentfa4eefe900b679c58ee0013198a9b11d036531ad
builtin/refs: add "rename" subcommand

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-refs.adoc
builtin/refs.c
t/meson.build
t/t1467-refs-rename.sh [new file with mode: 0755]