I have cloned an existing repository and find that only master branch is found in remote but develop branch is not there. When I tried to merge master and /origin/master branch to local develop branch, below errors pop up. How can I fix the error and create the /origin/develop branch? Thanks
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''
CodePudding user response:
As mentioned the develop branch in not on remote.
So first create the
develop
branch on your local repo usinggit checkout -b develop
Then pull branch
master
into this checked out develop branch by usinggit pull origin master
Finally push your local develop branch to remote
git push origin HEAD