Can't remove local branch that was merged and removed from GitHub.
$ git branch -d startapp warning: not deleting branch 'startapp' that is not yet merged to 'refs/remotes/origin/startapp', even though it is merged to HEAD. error: The branch 'startapp' is not fully merged. If you are sure you want to delete it, run 'git branch -D startapp'. $ git branch * master startapp $ git checkout startapp Switched to branch 'startapp' Your branch is ahead of 'origin/startapp' by 65 commits. (use "git push" to publish your local commits) $ git pull Your configuration specifies to merge with the ref 'startapp' from the remote, but no such ref was fetched.
The branch was removed after it was merged from GitHub. It is also fully merged in to master.
$ git log --graph --left-right --cherry-pick --oneline master...startapp $ $ git log --graph --left-right --oneline master...startapp $
Why the complain?
-d, --delete Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream.
Your branch is not fully merged to the upstream branch that was set ( and now it cannot be so merged because that upstream branch has been deleted).
This is a reasonable safety check: you want to think twice about deleting a branch that has commits not pushed to its origin. If you happen to know that everything is hunky dory, then follow the advice in the diagnostic:
If you are sure you want to delete it, run 'git branch -D startapp'.
If the branch is fully merged to master, simply do a checkout to master and then
git branch -D <your-fully-merged-branch>
Git is somewhat incorrect, as the message you receive is, in fact, a warning, and not an error.
In your specific case, it's normal that when
pulling from a merged branch you don't get any
refs. Go ahead and run
-D and there should be no problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With