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.
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