Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing to remote branch

Tags:

git

I have a git problem/question.

We are using bitbucket as our remote repo. Until now we've only had the master branch.

The other person I'm working on this with created a "develop" branch now the project is live for us to continue working on.

I've been working locally and have made changes and commited them.

I now want to push these to the remote "develop" branch.

I thought that

git push origin develop

would do it but i get

error: src refspec develop does not match any.

What does this mean?. I can see that the develop branch does indeed exist so what am I doing wrong?

Thanks so much for your help!

like image 918
markstewie Avatar asked Jan 23 '26 01:01

markstewie


1 Answers

Thanks for your answers, I've got things working again.

For anyone interested this is how I did it.

I did a

git pull origin master

and that updated my local repo and it was now aware there was a remote develop branch

I then did

git checkout develop

to switch to my local develop branch.. then

git merge master

to merge all the changes I had done in master into the develop branch Then doing

git push origin develop

worked fine.

Now all my changes are safe in the develop branch I can revert the master branch (where I was working) so it's the same as the remote master branch and everything is as it should be.

Not sure If that was the easiest way to go about it but I learned a lot about git.

Thanks again for your answers.

like image 90
markstewie Avatar answered Jan 25 '26 01:01

markstewie