简体   繁体   中英

Git Push to a remote branch with directory

I'm trying to push to a remote branch with a directory(I can't remove the directory or change the remote branch structure).

How can I push to this branch? I've already tried this command git push origin release/Release_1.0 and lots of variations.

This is the outcome:

$ git push origin release/Release_1.0
error: src refspec releaseRelease_1.0 does not match any.
error: failed to push some refs to 'https://github.com/Pankwood/LearningGit.git'

This is my branch structure:

 git branch --all
  dev
* master
  remotes/origin/dev
  remotes/origin/master
  remotes/origin/release/Release_1.0

Github structure image

The message indicates that you have no branch in your local repository named release/Release_1.0

If this branch exists on the remote, you can git checkout origin/release/Release_1.0 , perform your work, commit your changes, and then git push origin release/Release_1.0

tl;dr It looks like that branch was never created on your local repository.

you can firstly change to the branch you want to publish in this case you have to do this... git branch <branch> git checkout -b <branch> git add . git commit "Your commit" git push -u origin <branch> git branch <branch> git checkout -b <branch> git add . git commit "Your commit" git push -u origin <branch> in this case will be remotes/origin/release/Release_1.0 or remotes\\origin\\release\\Release_1.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM