Git push not creating remote branch, pushing to master
I'm having an issue where I'm trying to push a local branch to a remote branch so that I can then create a pull request into master. I'm using:
git push origin brachname
This seems to fail, and instead is pushing to the master remote branch (which isn't great). If I reference the local and remote branches explicitly (ie: branchname:branchname) it works fine. It seems that either I have something off with my git config, or there's something wrong with the way I'm creating my local branches.
Any help would be appreciated.
Looks like you are on the master
branch and trying to push it to another branch.
How to be able to push to different branch name?
Set/Update the tracking branch
git < 1.8:
git branch --set-upstream branch_name remote/branch_name
git > 1.8:
git branch branch_name --set-upstream-to remote/branch_name
Your current tracking information is inside your .git/config
file
Create a new branch with the desired name
git checkout -b <new_branch>
git push origin <new_branch>
git will push to the remote branch your current branch name (assuming you did not changed the tracking branch)
Renaming the branch (so the tracking branch will be updated too)
Or you can use the -u switch:
git branch branch_name -u remote/branch_name
Try the below
git push -u origin <branch_name>
If you have permission to push a local branch onto remote repo, it should go through
链接地址: http://www.djcxy.com/p/4652.html上一篇: 当工作没有完成时,git承诺和推动,我正在移动工作场所
下一篇: Git推动不创建远程分支,推动主人