-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Describe the bug
I have a workflow where I work on a branch (e.g. document-feature-flags-GH-401) locally and add a prefix when pushing it to GitHub (e.g. opdavies-document-feature-flags-GH-401). This means that in most cases, my local branch name does not match the remote branch name, but the local branch is tracking the remote branch.
For example, if I run git branch -vv:
document-feature-flags-GH-401 24849ad69 [origin/opdavies-document-feature-flags-GH-401] Document the use of feature flags
In this situation, the CLI currently assumes that the remote branch name is document-feature-flags-GH-401, and not the remote tracking branch name. This could be solved by making this the default behaviour and checking for the remote branch's name when creating the PR, or by allowing the option to specify the branch name using an argument similar to --base for the base branch.
Steps to reproduce the behavior
-
Create a branch (e.g.
test) -
Push it to GitHub using a different name (
git push -u test:test2) -
Run
gh pr createand see that it uses the local branch name rather than the remote oneCreating pull request for test into develop
Expected vs actual behavior
Use the remote tracking branch name rather than the local one.
Logs
~/Code/clients/xxx test [24849ad69] * $ git push origin -u test:test2
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'test2' on GitHub by visiting:
remote: https://github.com/odwd/xxx/pull/new/test2
remote:
To github.com:odwd/xxx.git
* [new branch] test -> test2
Branch 'test' set up to track remote branch 'test2' from 'origin' by rebasing.
~/Code/clients/xxx test [24849ad69] * $ gh pr create
Warning: 1 uncommitted change
Creating pull request for test into develop in odwd/xxx