Skip to content

[Fork] Improve how Desktop handles forks - tracking issue #8509

Open

Description

@billygriffin

This is a meta issue intended to clarify the landscape around problems related to forks of repositories. The primary use case for forks is to contribute to repositories where the person contributing does not have write access. However, we also need to ensure any work we do here doesn't explicitly break for people who are working in "long-running" forks that have entirely diverged from upstream.

These contributions are almost exclusively made via pull requests. This process today is confusing and Desktop can make it a lot simpler and help people get out of a bind more easily.

Problem 1: Trying to push changes to a repo you don't have write access to (issue here)

Update: Solution for this shipped in 2.3! 🚢 🎉

If you've cloned a repo and make some changes with the intent to contribute, you're basically stuck. You can't push those changes to the repo you've cloned because you don't have write access, and you can't bring them over to a fork that doesn't yet exist in a low-friction way.

Desktop could let you know you don't have write access and give you a nice pathway to fork and create a PR. This is conceptually similar to local commits to protected branches, where ideally we wouldn't allow you to do that (because you'd never be able to push those commits to that branch), and instead give you a nice path to somewhere where your work can eventually be pushed without issue.

A potential solution is outlined in #3918 by @say25.

Problem 2: "Create pull request" is still a suggestion even after I've created a pull request for the current branch on my fork (issue here)

Update: Solution for this shipped in 2.3! 🚢 🎉

After you create a PR from a branch of your fork that's targeting the upstream repo, the "Create pull request" suggestion is still displayed. This is very confusing because you already have a PR.

Example: I'm in billygriffin/desktop (a fork of desktop/desktop) on my branch new-work, and I make some commits and create a pull request targeting the development branch of desktop/desktop. In the app, I'm still shown the "Create pull request" suggested next step even though I've already created one.

Problem 3: Staying up to date on your fork with changes on upstream

Update: A partial solution to this, scoped only to when creating new branches, shipped in 2.4! 🚢 🎉

It's not at all straightforward how to pull in updates from the default branch of the upstream repo while you're working on a contributions on your forked repo. You don't necessarily know they exist, and even if you do it's not clear for people who don't do it frequently how to merge in those changes to get your branch up to date.

One way in which this manifests is when you're creating a new branch, and if there has been new work on the upstream repo, you're starting your branch out-of-date, described here by @outofambit: #7762

We also have an existing feature (notification when diverging from default branch) that was intended to solve some of this, but it's currently not working as designed. A potential path forward on that specifically is described here: #6875 (comment)

Problem 4: Viewing pull requests for the upstream repo from your fork (including your own PR) (issue here)

Update: Solution for this shipped in 2.4! 🚢 🎉

If you fork a repo and make a PR to contribute to the upstream repo, there's currently no way to view your PR in Desktop from your fork because the PR is associated with the upstream repo, not your fork of it.

After further consideration, we think that in nearly all cases, if you're working on a fork in Desktop you care most about the PRs targeting the parent repository. So we're going to show those, and it's just important to make clear to people that that's what they're seeing.

Problem 5: Cannot open a pull request from a GitHub.com PR page in your fork in Desktop (issue here)

Update: Solution for this shipped to production in 2.4 🎉 🚢

When you click "Open this pull request in Desktop," on a GitHub.com pull request page, Desktop attempts to clone the upstream repo, or opens the upstream repo if it already exists. You have to open the fork of the repo manually in the app. I'm not sure if an issue exists for this today, but if one does, please feel free to edit this and add a reference to it.

A few scenarios to consider:

  1. If you only have your fork in Desktop and upstream is the PR source, open it in your fork.
  2. If you only have your fork in Desktop and someone else's fork is the PR source, open it in your fork.
  3. If you have both repos (upstream and your fork) in Desktop, open the PR in the right one (based on the source of the PR).

Problem 6: Cannot check out a contributor pull request and push to it from Desktop

Update: Pushing to collaborator forks from Desktop works! ✅ 🚢 🎉

Related to the above, because you aren't able to check out a PR on a forked repo in Desktop as a maintainer, you also aren't able to push to the PR branch using the app. This is more fully described here by @haacked: #550 (we need to check to see if this is accurate)

Problem 7: It's not obvious that you're in a fork, or what the upstream repo is

We show this in the repo dropdown, but the symbol is not universally understood and there's no way to know what repository it's forked from.

Screen Shot 2019-10-24 at 2 45 58 PM

Problem 8: Issue and coauthor autocompletion doesn't inherit knowledge from upstream

If you try to add a coauthor, the handles do not autopopulate from upstream repo collaborators. In addition, if you attempt to reference an issue from the upstream repo, the reference doesn't work because it's only looking for issues in the fork itself.


Notes:

  • If you create a PR from your fork, "Create pull request" takes you to the "Create PR" page on GitHub.com and the PR targets the upstream default branch.

Activity

  1. added
    meta
    on Oct 22, 2019
  2. self-assigned this
    on Dec 1, 2019
  3. changed the title [-]Improve how Desktop handles forks[/-] [+][Fork] Improve how Desktop handles forks[/+] on Jan 7, 2020
  4. billygriffin commented on Jan 29, 2020

    @billygriffin
    ContributorAuthor

    Updating this issue since 2.3 shipped to production today. Problems 1, 2, and 6 no longer exist, and we think problems 5 and 3 will be our next areas of focus here. I'm going to make another issue for Problem 5 since it doesn't have one currently.

  5. say25 commented on Jan 30, 2020

    @say25
    Member

    Big steps in the right direction. Thanks for all the work so far.

  6. changed the title [-][Fork] Improve how Desktop handles forks[/-] [+][Fork] Improve how Desktop handles forks - tracking issue[/+] on Mar 17, 2020
  7. billygriffin commented on Mar 17, 2020

    @billygriffin
    ContributorAuthor

    Update: Problem 5 and part of problem 3 (staying up to date when creating a branch) will ship in 2.4 next week and both are now on beta.

    Problem 4 is next up, and problems 7 and 8 I'm a lot less concerned about for now and don't think they should be prioritized unless we see that people are struggling with them.

  8. say25 commented on Mar 26, 2020

    @say25
    Member

    Tested out the forking via GitHub Desktop for the first time in a while and ran into one majorish issue and one minorish issue.

    My Steps:

    1. Browse code (as one does) on GitHub and stumble upon a project I want to explore locally.
    2. Clone with the url in GitHub Desktop this case https://github.com/AutoMapper/AutoMapper.Collection.EFCore.git
    3. Make a modification I wish to submit for upstreaming
    4. Go to commit and hit the new "would you like to fork button".
    5. Click fork this project and a fork is created for me at https://github.com/say25/AutoMapper.Collection.EFCore.git

    Majorish Issue:

    1. As I am a heavier user of git for my Enterprise account, my global git config is set for my enterprise account. After forking to my public GitHub account, my git config for the newly forked project is still my GitHub Enterprise account.

    image

    Its hard to tell, but note my Enterprise Gravatar pulled in the bottom left, despite the fork to my public account.

    Proposed Solutions:

    1. Automatically set a local git config for the account I am forking to.

    Tangentially Related Minor Pain Point:

    1. Additional minor pain point, the ability to tweak my git config per project in Repository setting menu. I would be happy to take this on if the team thinks it is a good idea.

    Congrats

    I will say, major props to handling GitHub Public vs GitHub Enterprise forking, when making a fork it has proven to determine the correct account to fork.

  9. billygriffin commented on Apr 16, 2020

    @billygriffin
    ContributorAuthor

    @say25 Thanks for this! A couple things:

    As a general update, I crossed out (4) above as complete since we now display the PRs from upstream. 🎉

    Regarding your feedback, it sounds like the per-repo git config work that you're doing may rectify your issue above?

  10. say25 commented on Apr 16, 2020

    @say25
    Member

    Id classify it almost as a work around. To some extent, what would be ideal is when forking if it recognized the fork as for my public user github.com/say25/repo or my GHE enterprise server it would be amazing if this automatically happened

  11. guidezpl commented on Dec 16, 2020

    @guidezpl
    Contributor

    Great progress! Regarding 2/3 remaining problems, I had a few ideas and wanted feedback.

    Problem 3: Staying up to date on your fork with changes on upstream

    • Branch app menu → Update <master/main> from upstream
      • available on any branch, convenient
      • simple
      • 2 clicks
      • Screenshot 2020-12-16 at 13 09 26
    • in the "Merge in current branch" dialog.
      • available on any branch, convenient
      • maybe more complex, can merge any branches' upstream
      • 4 clicks
      • mocked up, Screenshot 2020-12-16 at 12 57 42
    • Enable the Merge <master/main> into <master/main> button, which is always disabled when on the master/main branch
      • only available when on the master branch
      • simple
      • 6 clicks, 2 clicks to switch to master branch, 4 to merge
      • Screenshot 2020-12-16 at 13 06 59

    Problem 7: It's not obvious that you're in a fork, or what the upstream repo is

    The obvious place for it is the repository button. Mocked up:

    Screenshot 2020-12-16 at 13 15 10

    Not the best example but since the repo name and org are the same, but the user/org you forked from is really what you care to know

  12. tidy-dev commented on Sep 16, 2024

    @tidy-dev
    Contributor

    Feedback about Forks and viewing branches on Forks. Similar to problem 8 on not being able to tell "fork" vs "upstream".

    Thanks. I've figured out a lot more about how these features work but there are still some major limitations for our workflow.

    Our team is exclusively using GHD, not the CLI at all (yet--they are students new to computers).
    Pushing to upstream is blocked.
    These limitations result in the following problems:

    Our developers aren't able to make a local branch that they can merge into upstream/refcode1.0.
    They only have master locally, and merging in from upstream/refcode1.0 doesn't work because master commits end up polluting the branch.
    The only way they can accomplish this (that I know of) is to first click on upstream/refcode1.0 and create the local branch tracking upstream.
    However, they can't push to upstream because pushing is blocked, and they can't change which remote the branch is tracking without leaving GHD and going into the CLI.
    Thus they need to make a branch off of the local refcode1.0 tracking upstream, and that branch will naturally track origin.
    Takeaways:

    In the list of branches, I wish there was a way to see which remote each branch is tracking at a glance without having to go into each branch
    I wish there was a way to change which remote a branch tracked from within GHD.
    I wish there was a way to create a new branch directly from a chosen upstream branch in GHD (e.g. git checkout -b myBranch upstream/refcode1.0)

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

Metadata

Metadata

Labels

epic:forkmeta

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions