push.default
is best covered in the man page of git config (man git-config
).
To understand the difference between “upstream” and “current” for push.default
, you should know the term upstream:
Upstream is a local pointer from a normal local branch to a local remote-tracking branch. (Yes, these are all local.) Examples:
- branch blabla has origin/blabla configured as upstream (very common)
- branch blabla has origin/foo as upstream (branch has a different local name; not so common)
- branch blabla has origin2/foo as upstream
Note that origin/* branches are local and (re-)set on each fetch from origin. These are called “local remote-tracking branches”. They represent the state of the branches on the remote “origin” at the time of the last fetch.
Each (normal) local branch can have an upstream configured, but this is no must: the configuration of an upstream relationship is only for convenience for some git commands!
If you do a git status
for example, git tells you “x commits behind/ahead” if it knows the upstream (so git can compare to it).
A normal initial git checkout blabla
usually sets up the upstream configuration for you (if origin/blabla exists, it is checked out and setup as upstream – otherwise the checkout fails).
git push
can also use the upstream configuration of a branch, i.e. to copy your new commits over to the remote branch which represents upstream. (This is push.default = upstream
.)
push.default = current
lets a git push
copy the new commits over to the remote under the same name. It completely ignores the upstream configuration. – If your local branch name is always the same as the remote one, both configurations have the same effect, except that git push
with push.default = upstream
will fail, if upstream is not configured yet.
PD: Yes, *
in the output of git branch
shows the current branch.