With Git 2.0, this setting was set to simple by default, to make it easy for beginners:
simple
- in centralized workflow, work like upstream with an added safety to refuse to push if the upstream branch’s name is different from the local one.
When pushing to a remote that is different from the remote you normally pull from, work as current. This is the safest option and is suited for beginners.
That has been rewritten with Git 2.33 (Q3 2021), adding clarification around git push
.
See commit 90cfb26, commit 7e6d72b, commit b8e8b98, commit 6b010c8, commit d099b9c, commit 3b9fd83, commit 050f76b (31 May 2021) by Felipe Contreras (felipec
).
(Merged by Junio C Hamano -- gitster
-- in commit 07e230d, 13 Jul 2021)
doc
: push: explain default=simple
correctly
Cc: Elijah Newren
Signed-off-by: Felipe Contreras
The simple mode only barfs when working on a centralized workflow, and there's no configured upstream branch with the same name.
git config
now includes in its man page:
simple
Pushes the current branch with the same name on the remote.
If you are working on a centralized workflow (pushing to the same repository you pull from, which is typically origin
), then you need to configure an upstream branch with the same name.
This mode is the default since Git 2.0, and is the safest option suited for
beginners.
That explains why the default setting is not the right one for your case, and you need, as noted above:
git config -g push.default upstream,
git push --set-upstream demo_origin master:demo_master
Note the second push is to be done only for the first push: once the upstream branch is set, a simple git push
(no parameters) will be enough.