]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/refs: add "delete" subcommand
authorPatrick Steinhardt <ps@pks.im>
Wed, 17 Jun 2026 10:15:59 +0000 (12:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Jun 2026 12:23:54 +0000 (05:23 -0700)
commit52fb7f94fcc20199cc7dc23db8d7f71ec37b80f8
treed0f35e26cad4d6dffa9713f2313171ed5ba90009
parent4a59ffe84961f6a3de29b302bcef188583a29dfa
builtin/refs: add "delete" subcommand

Reference-related functionality in Git is currently spread across many
different commands: git-update-ref(1), git-for-each-ref(1),
git-show-ref(1), git-pack-refs(1) and git-symbolic-ref(1). This makes it
hard for users to discover what functionality we have available to work
with references.

We have thus started to consolidate this functionality into git-refs(1),
which is a toolbox of everything related to references. Until now, the
command doesn't handle functionality of git-update-ref(1).

Fix this gap by introducing a new "delete" subcommand, which is the
equivalent of `git update-ref -d`.

Note that we're intentionally not using a generic "write" subcommand
with a "-d" flag. This is rather harder to discover, and subcommands
that are implmented as flags tend to be hard to reason about in the code
as we'd have to handle mutually-exclusive flags that stem from the other
subcommand-like modes.

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/t1464-refs-delete.sh [new file with mode: 0755]