首页 > 解决方案 > git remote push 命令中的混乱/严重错误(删除分支而不是更新它)

问题描述

在使用 git remote push 命令时遇到了一个危险的错误

命令将代码从一个本地/远程推送到另一个远程分支

git push <remote> <local branch name>:<remote branch to push into>

但是,如果您在冒号 (:) 之前的本地/远程源分支名称之后提及空格,它将删除目标远程分支

git push <remote> <local branch name>(single space):<remote branch to push into>

为了我

git push origin dev_test:develop(Pushed changes to remote develop)

git push origin dev_test :develop(deleted remote develop)

注意: dev_test 有新的变化,是开发的功能分支

随意不喜欢这个问题,你们甚至不理解我的问题的知名人士但是根据编码标准,如果命令中没有 --delete 或 -d ,它不应该删除 repo

标签: gitgithub

解决方案


这不是错误,这是已记录的功能。

推空<src>允许您<dst>从远程存储库中删除 ref。

https://git-scm.com/docs/git-push


推荐阅读