Re: [PATCH v14 4/6] branch: add --prune-merged <branch>
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 22, 2026, 12:26 UTC
- Message-ID
- <xmqqbjd24v7n.fsf@gitster.g>
- In-Reply-To
- <55a8cc56-f015-4a1b-b830-79cf24870286@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 12 quoted lines
> On 19/06/2026 17:01, Junio C Hamano wrote:
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>> - Notice that a branch that is deleted (because it itself is
>> merged) is still depended upon by being @{upstream} of somebody
>> else, and when it happens, fail the operation (i.e., do not
>> delete the branch).
>
> Not deleting is definitely the safest option. As Harald has pointed out
> we then need to think about what to do with the upstream branch of the
> branch we're keeping because it is an upstream of another branch that's
> not being deleted. Keeping the whole chain is probably safest.You're right.
> I think handling branches that are the upstream for another branch the > same way for "git branch -d" and "git branch --prune-merged" is a good idea.
Yeah. The latter should be a short-hand for
for each branch
do
if branch is merged to its upstream
then
remember to remove it
fi
done
now remove those we scheduled to remove with "git branch -d".so it would be clean if we can explain that philosophically the safety lies within "gir branch -d".
Thanks.