OK, first, some terminology:
A (regular, ordinary, local) branch is something like master
.
A "remote branch" like origin/master
is something stored in your local repository, to remember where, on the remote, the remote had its own (local) branch pointing.
A "remote branch" gets updated when you contact the remote (typically on fetch and push). At that time, your local git finds out what branches they have, and updates these.
A "tracking branch" is a local branch that records two items: a "remote", typically a name like origin
, and another "merge" name. For instance, if your local branch master
is a tracking branch, it may be configured with branch.master.remote = origin
and branch.master.merge = master
. Annoyingly, you can't always just string these together (you have to map through remote.origin.fetch
to be completely correct with this) but in general this means that your local master
is "tracking" origin/master
".
You can't1 create a "remote branch" locally. You have to fetch
or push
to/from the remote. If that remote has a local branch named X
, your git then records the remote's idea of that branch, using the origin/X
style name.
So, what's going on here? Well, you did this:
$ git checkout -b m1-master m1/master
That creates a local branch named m1-master
. (This local branch is also a tracking branch, but that's only partly relevant here, because of the push.default
setting below.)
Then, you did this:
$ git push
(with no remote name and no refspecs after push
). Git uses the default remote, which turns out to be m1
because of the tracking. Next though, git uses a default refspec, based on push.default
and/or other git config
items.
As of git 1.8.4.2 the "default push.default
" is matching
. This would not create a new branch (but also won't push anything unless there's an m1-master
there). You have it set to current
, which means: "please update or create, on the remote, the current branch, using its current name." The current branch is m1-master
, so that was created.
Change push.default
to upstream
to fix this:
git config push.default upstream
(Also, see "Warning: push.default is unset; its implicit value is changing in Git 2.0" for various other options.)
1Well, you can do it with git update-ref
or manual poking about in your .git
directory. :-) Just, not with "normal" user commands.