path: root/Documentation
diff options
authorJunio C Hamano <>2013-01-05 00:02:29 (GMT)
committerJunio C Hamano <>2013-06-18 19:36:00 (GMT)
commitb2ed944af79041b4da151a432064c3b1c1b82fc5 (patch)
treec8b44001afc8eff3b318231169613125cea35b85 /Documentation
parentac47a22a7a3c01d38b39c6896a1965ac0b9c473d (diff)
push: switch default from "matching" to "simple"
We promised to change the behaviour of lazy "git push [there]" that does not say what to push on the command line from "matching" to "simple" in Git 2.0. This finally flips that bit. Helped-by: Matthieu Moy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation')
2 files changed, 18 insertions, 21 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index bf8f911..2fe88f0 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -142,17 +142,11 @@ advice.*::
Set this variable to 'false' if you want to disable
- 'pushNonFFCurrent', 'pushNonFFDefault', and
+ 'pushNonFFCurrent', and
'pushNonFFMatching' simultaneously.
Advice shown when linkgit:git-push[1] fails due to a
non-fast-forward update to the current branch.
- pushNonFFDefault::
- Advice to set 'push.default' to 'upstream' or 'current'
- when you ran linkgit:git-push[1] and pushed 'matching
- refs' by default (i.e. you did not provide an explicit
- refspec, and no 'push.default' configuration was set)
- and it resulted in a non-fast-forward error.
Advice shown when you ran linkgit:git-push[1] and pushed
'matching refs' explicitly (i.e. you used ':', or
@@ -1750,15 +1744,15 @@ push.default::
since locally stalled branches will attempt a non-fast forward push
if other users updated the branch.
- This is currently the default, but Git 2.0 will change the default
- to `simple`.
+ This used to be the default, and stale web sites may still say so,
+ but Git 2.0 has changed the default to `simple`.
* `upstream` - push the current branch to its upstream branch.
With this, `git push` will update the same remote ref as the one which
is merged by `git pull`, making `push` and `pull` symmetrical.
See "branch.<name>.merge" for how to configure the upstream branch.
* `simple` - like `upstream`, but refuses to push if the upstream
branch's name is different from the local one. This is the safest
- option and is well-suited for beginners. It will become the default
+ option and is well-suited for beginners. It has become the default
in Git 2.0.
* `current` - push the current branch to a branch of the same name.
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 8b637d3..2d8498a 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -36,10 +36,14 @@ OPTIONS[[OPTIONS]]
The format of a <refspec> parameter is an optional plus
`+`, followed by the source ref <src>, followed
by a colon `:`, followed by the destination ref <dst>.
- It is used to specify with what <src> object the <dst> ref
- in the remote repository is to be updated. If not specified,
+ It is used to specify what <src> object the <dst> ref
+ in the remote repository is to be updated to. If no
+ <refspec> is specified on the command line, and if no
+ <refspec> is configured for the <repository>,
the behavior of the command is controlled by the `push.default`
- configuration variable.
+ configuration variable, and if it is unset, the `simple`
+ behaviour is used (see lingit:git-config[1] and look
+ for `push.default`).
The <src> is often the name of the branch you would want to push, but
it can be any arbitrary "SHA-1 expression", such as `master~4` or
@@ -65,14 +69,11 @@ the remote repository.
The special refspec `:` (or `+:` to allow non-fast-forward updates)
directs git to push "matching" branches: for every branch that exists on
the local side, the remote side is updated if a branch of the same name
-already exists on the remote side. This is the default operation mode
-if no explicit refspec is found (that is neither on the command line
-nor in any Push line of the corresponding remotes file---see below) and
-no `push.default` configuration variable is set.
+already exists on the remote side.
- Instead of naming each ref to push, specifies that all
- refs under `refs/heads/` be pushed.
+ Push all branches (i.e. refs under `refs/heads/`); cannot be
+ used with other <refspec>.
Remove remote branches that don't have a local counterpart. For example
@@ -357,8 +358,10 @@ Examples
configured for the current branch).
`git push origin`::
- Without additional configuration, works like
- `git push origin :`.
+ Without additional configuration, pushes the current branch to
+ the configured upstream (`remote.origin.merge` configuration
+ variable) if it has the same name as the current branch, and
+ errors out without pushing otherwise.
The default behavior of this command when no <refspec> is given can be
configured by setting the `push` option of the remote, or the `push.default`