git branch -d 发出警告
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12147360/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git branch -d gives warning
提问by user1322228
Just want to get a better understanding of the warning message after I deleted a local branch
只是想在我删除本地分支后更好地理解警告消息
warning: deleting branch
'old_branch'
that has been merged to'refs/remotes/origin/old_branch'
, but not yet merged toHEAD
.
警告:删除
'old_branch'
已合并到'refs/remotes/origin/old_branch'
,但尚未合并到 的分支HEAD
。
回答by cjhveal
This is just warning you that you have changes pushed to the branch on origin
, but they are not merged into master
, so you are only deleting it locally.
这只是警告您已将更改推送到 上的分支origin
,但它们并未合并到 中master
,因此您只是在本地删除它。
It is warning you that you no longer have a local copy of that branch, but it exists in origin
它警告您您不再拥有该分支的本地副本,但它存在于 origin
If you want to delete the remote branch as well, use git push --delete origin old_branch
如果您还想删除远程分支,请使用 git push --delete origin old_branch
回答by Karl Bielefeldt
Assuming you currently have master
checked out, it means the changes made in old_branch
aren't present in master
. However, they arepresent in old_branch
on origin
.
假设您当前已master
签出,则意味着 中所做的更改old_branch
不存在于master
. 然而,他们都出现在old_branch
上origin
。
回答by Mithun Nair
To add to the other answers, this can also mean that the change might be merged to master, just that your local copy of master does not reflect it yet. Either ways this just informs you that the local copy of your master does not have the changes you pushed on origin. Merged/Not merged...maybe,maybe not
要添加到其他答案中,这也可能意味着更改可能会合并到 master,只是您的 master 本地副本尚未反映它。无论哪种方式,这只会通知您,您的母版的本地副本没有您在原点上推送的更改。合并/未合并...也许,也许不
回答by Max Komarychev
This means your local branch old_branch
is up to date with remote branch old_branch
on remote origin
but it is not merged to the branch master
which is considered to be the main branch in the repo.
这意味着您的本地分支old_branch
与远程old_branch
上的远程分支是最新的,origin
但它没有合并到master
被认为是 repo 中的主分支的分支。
It is just a precaution from git. It gives you a hint: maybe you did your job in the topic-branch and forget to merge it to the main branch?
这只是 git 的预防措施。它给了您一个提示:也许您在主题分支中完成了工作而忘记将其合并到主分支?
update
更新
Git warns you from losing your changes. For example if you do not have your old_branch
on the master git then don't allow you to even delete branch that is unmerged to the master (well it allow, but with key -D
which is force-delete
option).
Git 会警告您不要丢失更改。例如,如果您old_branch
在 master git 上没有,则不允许您甚至删除未合并到 master 的分支(它允许,但使用 key-D
是force-delete
选项)。