Pushing to remote branch

I have a git problem/question.

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

  • Difference between git merge with commits in common and git merge with unrelated branches
  • Git: iOS Create an experimental iPad branch
  • shell_exec configuration for git pull Godaddy vs Bluehost
  • “git remote show origin”: why all branches show “tracked” even when some aren't?
  • How can I remotely edit/create a wiki for a GitHub Repo?
  • How can I push to a git-svn repo?
  • 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!

  • Choosing a source control system: logical next steps after VSS
  • Git Python Cannot find Commit
  • How to commit a directory into a git repository?
  • what's the proper way to work with Git Submodules
  • Changes in git working directory refuse to be reverted
  • making a git push from a detached head
  • 5 Solutions collect form web for “Pushing to remote branch”

    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.

    develop exist in where? local? remote? or both? Try:

    git push origin HEAD:develop

    If you use

    git push <repo> <src>

    git push origin develop

    then git expects to find a local branch called ‘develop’ that it can take to push to a remote branch of the same name. Since there is no local branch of that name you get the error.

    So, if you want to push to a new (or existing) remote branch that has a different name locally then you would do the following:

    git push <repo> <src>:<dst>


    git push origin master:develop

    That should work. *checks*. It does.

    You have not yet pulled develop from the server. You have a remote develop branch, but you do not have a local develop tracking branch.

    git checkout develop

    This will create the local develop tracking branch.

    If you already committed your changes, those changes are on the master branch that you were using before. Moving those changes to the develop branch is a bit more complicated.

    Moving those changes can be explained once we’ve identified the problem that you are actually having.

    Did you forget to commit your work? This happens when you clone an empty repo, add files but forget to commit them before pushing.

    Git Baby is a git and github fan, let's start git clone.