According to your comments, you're on a branch called query/master
, which is slightly unusual. Was creating that branch (refs/heads/query/master
) deliberate?
In any case, the problem is as follows. When you do:
git push origin master
... git assumes that you mean:
git push origin master:master
... i.e. "try to make the master
branch in origin
the same as my local master
branch". However, you're not on the local branch called master
- you're on query/master
. Instead you need to do:
git push origin query/master:master
If what you really want is to start working on your master
branch instead of query/master
, then you can do the following:
# Check that the output of `git status` is clean, to make
# sure you don't lose any uncommitted work:
git status
# Switch to the master branch:
git checkout master
# Create a branch called old-master that records where master
# originally was, in case you still want that:
git branch old-master
# Reset your master branch to where query/master was:
git reset --hard refs/heads/query/master
Thereafter, when you're working on the master
branch, git push origin master
should do what you expect.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…