无法删除已从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.
分支从GitHub合并后被删除。它也完全融入了主人。
$ git log --graph --left-right --cherry-pick --oneline master...startapp
$
$ git log --graph --left-right --oneline master...startapp
$
为什么抱怨?
答案 0 :(得分:3)
来自man git-branch
:
-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.
您的分支未完全合并到已设置的上游分支( 现在它不能合并,因为上游分支已经 删除)。
这是一个合理的安全检查:你想三思而后行删除一个 承诺没有被推到原点的分支。如果你碰巧知道这一点 一切都是hunky dory,然后按照诊断中的建议:
If you are sure you want to delete it, run 'git branch -D startapp'.
答案 1 :(得分:1)
如果分支完全合并为主分支,只需执行结账以掌握,然后
git branch -D <your-fully-merged-branch>
Git有些不正确,因为您收到的消息实际上是一个警告,而不是错误。
在您的具体情况下,从合并分支pull
开始,您没有得到任何ref
是正常的。继续运行-D
,应该没有问题。