Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 无法推送与已删除分支同名的新分支以在远程存储库上创建分支_Git_Push_Bitbucket Server_Sourcetree - Fatal编程技术网

Git 无法推送与已删除分支同名的新分支以在远程存储库上创建分支

Git 无法推送与已删除分支同名的新分支以在远程存储库上创建分支,git,push,bitbucket-server,sourcetree,Git,Push,Bitbucket Server,Sourcetree,好吧,标题很混乱,但发生的事情如下: -有一个本地分支及其相应的远程分支 -删除了两个分支 -使用相同的名称重新创建分支,并应用我的更改 -无法推送到远程存储库,因为: 'Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before

好吧,标题很混乱,但发生的事情如下:

-有一个本地分支及其相应的远程分支

-删除了两个分支

-使用相同的名称重新创建分支,并应用我的更改

-无法推送到远程存储库,因为:

'Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details."

实际上,您没有删除远程分支,而是删除了本地分支(
git branch-d
),可能还删除了对远程分支的本地引用(
git branch-d-r

要删除远程分支,您需要
推送
对远程的空引用:
git push remote\u NAME:remote\u branch\u NAME
。冒号前的空格是空引用,告诉
REMOTE\u NAME
删除分支
REMOTE\u branch\u NAME


现在,如果您认为您已经删除了远程分支,并且您的目的只是删除它,然后向上推送您的新分支,那么您可以节省一个步骤,只需执行强制推送:
git push-f
,这将具有相同的效果。

您使用了哪些命令来执行“删除两个分支”步骤?