Re: [PATCH v10 2/4] branch: add --prune-merged <branch>
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 22, 2026, 01:17 UTC
- Message-ID
- <xmqqmrxsxmxp.fsf@gitster.g>
- In-Reply-To
- <718e28c7e0120a826385189213cccec1f0fce1af.1779403204.git.gitgitgadget@gmail.com>
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 7 quoted lines
> +`--prune-merged`:: > + Delete the local branches that `--forked` would list for > + the same _<branch>_ arguments, but only those whose tip is > + reachable from their configured upstream. > ++ > +For arguments that refer to remote-tracking branches, run > +`git fetch` first ...
Please don't.
"git branch -d <derived>" checks if <derived> has already been merged to its <upstream> as your repository currently sees it, and this makes "--prune-merged" inconsistent. Before deciding to use "--prune-merged", the user may have sanity checked if it is safe to remove by running "git branch -no-merged", whose answer hence user's sanity checking will be invalidated by your auto-update from the upstream.
It also means that you cannot prune already merged ones while you are not online.