I needed to merge two branches — second into first and then get rid of second. Here’s what I did:
git cloned the project to get a fresh copygit checkout --track origin/second, made some changes, and committedgit checkout --track origin/first, made some changes, and committedgit merge second(git says “merge made by recursive”)git branch -d second
Then git says:
$ git branch -d second
warning: not deleting branch 'second' that is not yet merged to
'refs/remotes/origin/second', even though it is merged to HEAD.
error: The branch 'second' is not fully merged.
If you are sure you want to delete it, run 'git branch -D second'.
Why is this happening? I’ve never gotten this message after a merge before. The merge worked just fine, no conflicts. How do I safely delete the second branch?
Based on my experiments and @knittl’s and @twalberg’s comments, it seems that git just wanted me to push my changes to the
secondbranch before deleting it.I did:
which worked without warnings.