mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
Currently we try to delete a branch normally, and if git returns an error and its output contains the text "branch -D", then we prompt the user to force delete, and try again using -D. Besides just being ugly, this has the disadvantage that git's logic to decide whether a branch is merged is not very good; it only considers a branch merged if it is either reachable from the current head, or from its own upstream. In many cases I want to delete a branch that has been merged to master, but I don't have master checked out, so the current branch is really irrelevant, and it should rather (or in addition) check whether the branch is reachable from one of the main branches. The problem is that git doesn't know what those are. But lazygit does, so make the check on our side, prompt the user if necessary, and always use -D. This is both cleaner, and works better. See this mailing list discussion for more: https://lore.kernel.org/git/bf6308ce-3914-4b85-a04b-4a9716bac538@haller-berlin.de/