Reputation: 135
I am working on a branch, 'development'. On Github, I created a new branch called 'Temporary'. I want to push my current code to branch temporary.
In my workspace doing
git branch
gives * development master
On trying,
git push origin temporary
I get: src refspec temporary does not match any
The git show-ref doesn't show the branch either
What can I do to push to the new branch temporary?
Upvotes: 1
Views: 2961
Reputation: 959
You should first create a branch locally and checkout to that new branch
git checkout -b temporary
Make all changes, commit your code and then do this
git push origin temporary
Upvotes: 0
Reputation: 522646
You seem to be confused about Git's workflow. Typically, there are two possible scenarios here. The first is that you pull the temporary
branch on GitHub to your local machine. You would then do some work and eventually sync up with GitHub by doing a git push origin temporary
. The second scenario is that you create a local branch on your machine called temporary
. You could do this from the master
branch by doing git branch temporary
. You would then push this branch to GitHub using git push origin temporary
.
If you are certain that you really want to push the master
branch to the temporary
branch on GitHub, then you can force it by doing git push origin temporary --force
From your later comments, this is what you want to do:
git checkout master
# work work work
git checkout -b temporary
git push origin temporary
Upvotes: 2