pr view
and pr status
should respect with remote.pushdefault
#9364
Labels
pr view
and pr status
should respect with remote.pushdefault
#9364
Description
When using a triangular workflow, it is possible to have a branch merge changes from
upstream
while pushing changes to afork
. For example, imagine that we are working on a branchfeature
in our fork and we want to continually be rebasing onupstream/main
, we could do that like so:First we clone the fork:
Then we check out a branch so that it is tracking
upstream/main
:Then we set
remote.pushdefault
toorigin
so that all branches are pushed toorigin
instead ofupstream
:So we create new a commit on the branch, and a new pull request (note that
git push
knew where to push to due toremote.pushDefault
):However when we try to view our newly created PR it fails because it is trying to find a PR from
main
since that is the currentmerge
entry in the branch config:Unfortunately, resolving
@{push}
doesn't work because themerge
entry for the branch config has a different branch name:Proposed Solution
Fortunately we know that if our
push.default = current / simple
(meaning local and remote branch have the same name) then with theremote.pushDefault
telling us the correct remote we can concatenate these which will give us:origin/remote-push-default-feature
and we'll be able to find the PR!Additional context
This is already implemented by #9208, I'm just capturing the specific enhancement separately as it was kind of hard for me to understand as someone that's never used these features before.
The text was updated successfully, but these errors were encountered: