git push a sub branch

I was in branch feature_swap there I did some change but I am not confident enough to push those changes in feature_swap branch. So I tried to create another sub branch feature_swap_experiment with

git branch feature_swap_experiment
git checkout feature_swap_experiment

Now I want to push to feature_swap_experiment I've tried
git push origin feature_swap_experiment which is not working

error: src refspec feature_swap_experiment does not match any.
error: failed to push some refs to 'https://uname@bitbucket.org/uname/project.git'

git push origin feature_swap_experiment

should be the right command. Is there any chance that your remote is not set up correctly?

  • if you check master back out, can you push to the remote?
  • Do the contents of your .git/config file look correct? Especially check the [remote "origin"] section of the file.
  • Also, git branch -a should give you a list of all branches, local and remote, so you should be able to quickly see if things are set up correctly.

    This may help: How do you create a remote Git branch?

    Edit: After looking at the error message you added to the question, it seems like you might have the same problem as described here: Error when "git push" to github

    So in your case, you would run:

    git push https://uname@bitbucket.org/uname/project.git  HEAD:feature_swap_experiment
    
    链接地址: http://www.djcxy.com/p/4610.html

    上一篇: 为什么我不能把镜子推到github上?

    下一篇: git推一个子分支