Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set push.default = upstream only when necessary #38

Open
hakoerber opened this issue Jun 30, 2022 · 0 comments
Open

Set push.default = upstream only when necessary #38

hakoerber opened this issue Jun 30, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@hakoerber
Copy link
Owner

hakoerber commented Jun 30, 2022

push.default = upstream is only necessary when the remote branch name differs from the local branch name. Otherwise, simple is much more ergonomic.

upstream leads to weird behaviour if there are multiple remotes. The problem is that only one remote can be the one with the upstream branch. Pushing to others without an explicit remote branch leads to the following error:

--- [origin] ---
fatal: You are pushing to remote 'origin', which is not the upstream of
your current branch 'develop', without telling me what to push
to update which remote branch.

It might make sense to print a warning in that case (multiple remotes with branch naming mismatch), which should be rare enough.

Currently, push.default is just set during worktree init/clone/conversion. In the future, this would also need to be done during each sync, as the number of remotes may change and the setting may have to be changed accordingly.

Also, the setting is currently repo-specific. But actually, it would be worktree-specific. Some worktrees might match the remote branch (master/main/develop being common), while others may not (I like to use a prefix with feature branches for example). Only the latter should use push.default = upstream when using multiple remotes.

@hakoerber hakoerber added the enhancement New feature or request label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant