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

Feature request to for Desktop to remember the base branch and using that as the target base when creating a GitHub pull request #15806

Open
caendesilva opened this issue Dec 20, 2022 · 4 comments

Comments

@caendesilva
Copy link

caendesilva commented Dec 20, 2022

The feature request

I often use the 'create branch' feature to work on parallel pull requests.

image

After writing some code, my next step is to publish the branch to GitHub and create a pull request. I also do this using Desktop.
image

But now, the created pull request targets the default 'master' branch. But since I'm working on a PR to a non-default branch, I have to manually switch the target, which I sometimes forget. It would be amazing if Desktop could remember which branch I based the new one off, and selected that as the PR target.
image

TLDR: When creating a branch in Desktop then making a pull request still via Desktop, it would be great if it remembered the target branch

Proposed solution

When using the 'Create pull request' feature, it could remember the base branch and use that to generate the URL being opened.

# For example:
https://github.com/user/repo/compare/develop...my-added-fix
# Instead of the current:
https://github.com/user/repo/compare/main...my-added-fix

Additional context

No response

@tidy-dev
Copy link
Contributor

tidy-dev commented Dec 20, 2022

Thank you for the suggestion. However, seeing as GitHub Desktop attempts to support common version control workflow pattern (feature-branch -> default branch) and is possible that implementing this could distract from other user's workflow patterns, it is not likely we will make this change.

That said, I am fan of stacking PR's myself I can see the value. I have tagged it as an enhancement to keep this issue open to track feedback from users to see if it can be something to consider in the future.

Other notes you may find interesting, we have an upcoming feature partially in beta for previewing the changes of a pull request before you create it on GitHub. It is planned (not quite in beta yet) that this feature will open GitHub to the base branch you select in the preview pull request dialog. (Still need to switch it there, but possibly a more convenient place to recognize you are comparing to the default branch)

@caendesilva
Copy link
Author

Okay cool, I appreciate the response! The upcoming feature sounds promising!

@jaunt
Copy link

jaunt commented May 9, 2024

If the usual flow is feature-branch -> default branch, would it be common for someone to create a branch based on some other branch, then PR directly to the default branch? If they almost always create a branch based on the default branch, then the proposed solution seems like it wouldn't bother that user? I find the way it works now very error prone when working off long term feature/project branches, or even a main/development branch situation, where developers work off development and main is reserved for production.

@caendesilva
Copy link
Author

If the usual flow is feature-branch -> default branch, would it be common for someone to create a branch based on some other branch, then PR directly to the default branch? If they almost always create a branch based on the default branch, then the proposed solution seems like it wouldn't bother that user? I find the way it works now very error prone when working off long term feature/project branches, or even a main/development branch situation, where developers work off development and main is reserved for production.

Indeed. Doesn't even need to be that main is reserved for production, it could also be for an upcoming major version. For example, I'm currently working on the v2 version of a software on GitHub. Until it's ready for rollout the master branch is used for v1, and v2 is on a 2.x-dev branch. A draft PR is set to target the master branch, but most of the development are made in granular sub-PRs to the 2.x-dev branch from feature branches created from that one.

For example:

PR 123 is on 2.x and targets main
PR 124 is on 2.x/feature and targets 2.x

I don't think this is a too uncommon workflow actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants