Re: [PATCH] branch: error description when deleting a not fully merged branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10-ene-2024 09:48:52, Junio C Hamano wrote:
> Rubén Justo <rjusto@xxxxxxxxx> writes:
> 
> > The error message we show when the user tries to delete a not fully
> > merged branch describes the error and gives a hint to the user:
> >
> > 	error: the branch 'foo' is not fully merged.
> > 	If you are sure you want to delete it, run 'git branch -D foo'.
> >
> > Let's move the hint part so that it takes advantage of the advice
> > machinery:
> >
> > 	error: the branch 'foo' is not fully merged
> > 	hint: If you are sure you want to delete it, run 'git branch -D foo'
> > 	hint: Disable this message with "git config advice.forceDeleteBranch false"
> 
> This is probably one sensible step forward, so let's queue it as-is.

Thanks.

> But with reservations for longer-term future direction.  Stepping
> back a bit, when 'foo' is not fully merged and the user used "branch
> -d" on it, is it sensible for us to suggest use of "branch -D"

Maybe the user hits here because he's doing "branch -d" and so I would
find a more clear suggestion: "branch -d foo -f".

Or to be more generic, not suggesting a command line but a description
that explains how to use "the force" ... :) sorry for the joke

Anyway, I think you mean to suggest a less destructive approach.  Which
is fine by me.

> Especially now this is a "hint" to help less experienced folks, it
> may be helpful to suggest how the user can answer "If you are sure
> you want to delete" part.  As this knows what unique commits on the
> branch being deleted are about to be lost, one way to do so may be
> to tell the user about them ("you are about to lose 'branch: error
> description when deleting a not fully merged branch' and other 47
> commits that are not merged the target branch 'main'", for example).

That's an interesting idea.  Maybe the hint becomes more informative
than a simple advice ...  maybe a more-verbose error is needed ...  just
thinking out loud ...

> 
> Another possibility is to suggest merging the branch into the
> target, instead of suggesting a destructive "deletion", but I
> suspect that it goes too far second-guessing the end-user intention.
> 
> Thanks.

Thank you.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux