Skip to content

push: suggest remote.pushDefault when "simple" refuses to push - #2467

Draft
HaraldNordgren wants to merge 1 commit into
git:masterfrom
HaraldNordgren:push-simple-pushdefault-hint
Draft

HaraldNordgren wants to merge 1 commit into
git:masterfrom
HaraldNordgren:push-simple-pushdefault-hint

Conversation

@HaraldNordgren

@HaraldNordgren HaraldNordgren commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

After cloning a project and adding a fork, a branch started from origin/main cannot be pushed with a plain git push under the default push.default=simple, and the advice only offers ways to push to origin. When the repository has another remote, also show how to push there and how to make that the default:

To push to the branch of the same name on another remote, use

    git push fork HEAD

To make that the default, use

    git config set remote.pushDefault fork

After cloning a project and adding a fork as a second remote, a
branch started from "origin/main" cannot be pushed with a plain
"git push" while push.default is left at "simple", because its
upstream branch has a different name. The advice offers to push to
the upstream branch, or to a branch of the same name on "origin".
Both go to the project's repository, which someone working in a fork
usually cannot push to. The usual way out, "git push -u" to the fork,
moves the upstream there, so the branch is no longer compared with
the project's branch.

Setting remote.pushDefault to the fork makes a plain "git push" go to
a branch of the same name there, and leaves the upstream alone. When
the repository has another remote, show how to push to it, and how
to make that the default with remote.pushDefault. With more than one
other remote, show "<remote>" in place of a name.

Show it in place of the advice to set branch.autoSetupMerge to
"simple". That setting would leave a branch started from
"origin/main" without an upstream, and with it the comparison with
the project's branch.

Do not show it when remote.pushDefault or branch.<name>.pushRemote
is already set. The push then went to this remote on purpose, as in a
trunk-based setup where every branch is pushed to the one remote.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
@HaraldNordgren
HaraldNordgren force-pushed the push-simple-pushdefault-hint branch from bb77452 to 2c59c7a Compare October 23, 2026 16:56
@taufiqshah974-crypto

Copy link
Copy Markdown

Im new at sime but im take from data past away to rebuilt generation future

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants