]> git.ipfire.org Git - thirdparty/git.git/commit
branch: add --dry-run for --prune-merged
authorHarald Nordgren <haraldnordgren@gmail.com>
Fri, 22 May 2026 11:31:38 +0000 (11:31 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 May 2026 08:41:08 +0000 (17:41 +0900)
commit16c839fd3200f1f4119730d6a3545e08db2f7729
tree99280509043a1547f36ed3762c081d107d3eb07c
parentc6b3502040db6b8c9b228511045927bf6cd14cf1
branch: add --dry-run for --prune-merged

With --dry-run, --prune-merged prints the local branches it would
delete -- one "Would delete branch <name>" line per candidate --
and exits without touching any ref.

This is the natural sanity check before letting a broad pattern
like 'origin/*' run for real: the @{push}-vs-@{upstream} and
unmerged filtering still applies, so the dry-run output is
exactly the set that the live run would delete.

--dry-run is only meaningful in combination with --prune-merged
and is rejected otherwise.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-branch.adoc
builtin/branch.c
t/t3200-branch.sh