Re: [PATCH v3 4/4] doc: git-push: clarify "what to push"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 26, 2025, 01:27 UTC
- Message-ID
- <xmqq348admuo.fsf@gitster.g>
- In-Reply-To
- <1422594f-b0a8-4a7a-bf78-940693757224@app.fastmail.com>
"Julia Evans" <julia@jvns.ca> writes:
Show 5 quoted lines
> As I understand it, with push.default=simple, the reason you need to set > the upstream is not to tell Git what branch to update (since Git will not > even let you set the upstream to a branch with a different name), but > instead it's more of a safety check to prevent you from accidentally > pushing a branch that you didn't mean to. Is that wrong?
Your understanding is correct, but when push.default=simple castrates "git push", and you are on branch 'foo', it is dubious to argue that "git push" _knows_ it will be pushed to 'foo' at origin.
It is very much conditional---what Git is being told is that the push would be made there only if branch.foo.{remote,merge} were set up to push these. If the setting is not there, then Git does not know where to push to.
I agree with you that setting these configurations is *not* about letting Git know. It is about lifting that conditional that prevents Git from knowing where to push to.
> But I'm not sure it's true in this case: we just said above that > "The default is `push.default=simple`, which will push to a branch with > the same name as the current branch."
So I think this simplified statement is what causes confusion. It says push.default=simple will push to such and such place, but that is not true. push.default=simple only means that no settings that points a branch with different name as your upstream is accepted. And configured upstream is what determines what branch at what remote is updated with a push.
You can tell the same story about push.default=upstream; configured upstream is what determines what branch at what remote is updated in this case, too, and it won't push out if you do not have your upstream configured.