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

The "update" subcommand cannot only update an existing reference, but it
can also create new branches and delete existing branches by specifying
the all-zeroes object ID as either old or new value. Despite that, we
already have the "delete" subcommand as a handy shortcut so that a user
can easily delete a branch. This relieves them of needing to understand
the more arcane uses of the "update" command, and of counting the number
of zeroes they need to pass.

But while we have a "delete" subcommand, we don't have an equivalent
that would allow the user to create a new branch, which creates a
certain asymmetry.

Add a new "create" subcommand to plug this gap.

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