gitgit-branch

Disable error message: `error: The branch 'stack' is not fully merged.`


I had rebased my commits and merged stack branch into current one.

< e6c8324 (HEAD -> bot) Add '/' to url in API::Redmine
<   4c785be Merge branch 'stack' into bot
|\  
| = b52b42c Reconfigure stack Put Bot into office-net network. Thus we can remove own tra>
| = b0149ff Tune application on production differently
| = 3a308b9 Changed redmine files path to /db
|/  
< 21c0f91 Fix fatal error which to cause by sending edit message
< 07c50ba Fix list commands and aliases
< 41c5825 Provide aliases
< 4dc5ae6 Unnecessary commented code deleted
| = 4e6e52a (stack) Reconfigure stack Put Bot into office-net network. Thus we can remove>
| = ed7bc5b Tune application on production differently
| = bfd958e Changed redmine files path to /db
|/  
o 798fd89 Merge branch 'clean-up-stack-bulding' into bot

When I try to delete that stack branch, I get error:

$ git branch -d stack
error: The branch 'stack' is not fully merged.
If you are sure you want to delete it, run 'git branch -D stack'.

Is there a way to silence error message in my case: when commits has different IDs, but are similar and merged?


Solution

  • As shown in your git log output, commit 4e6e52a is indeed not merged into the current bot branch (commit e6c8324), so Git's complaint here is correct. But as you note in the body of the question, the commits that are merged (e.g., b52b42c) are patch-ID-equivalent to the commits that aren't merged.

    Git's git branch -d does not detect this case (and never has done so), so you must do your own detection and invoke a force-delete (git branch --force -d or git branch -D) to force git branch to delete without complaining.