如何修复 Sourcetree 中远程缺失的 Develop Branch?

How to fix the missing Develop Branch in remote in Sourcetree?

我已经克隆了一个现有的存储库,发现远程中只有 master 分支,但没有 develop 分支。当我尝试将 master 和 /origin/master 分支合并到本地开发分支时,弹出以下错误。如何修复错误并创建 /origin/develop 分支?谢谢

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags --set-upstream origin develop:develop
Pushing to 'GOT folder'
error: refs/heads/develop does not point to a valid object!
error: refs/heads/feature/xxxx does not point to a valid object!
remote: error: refs/heads/develop does not point to a valid object!        
remote: error: refs/heads/feature/xxxx does not point to a valid object!        
remote: fatal: bad object .alternate        
error: refs/heads/develop does not point to a valid object!
error: refs/heads/feature/xxxxx does not point to a valid object!
fatal: bad object .alternate
To 'GOT folder'
 = [up to date]      1.0 -> 1.0
 = [up to date]      1.1 -> 1.1
 = [up to date]      1.2 -> 1.2
 ! [remote rejected] develop -> develop (missing necessary objects)
error: failed to push some refs to ''GIT folder''

如前所述,开发分支不在远程。

  • 因此,首先使用

    在本地存储库上创建 develop 分支

    git checkout -b develop

  • 然后使用

    将分支 master 拉入这个签出的开发分支

    git pull origin master

  • 最终将本地开发分支推送到远程

    git push origin HEAD