Hacker News new | ask | show | jobs
by justinclift 81 days ago
When the base and PR branch are in different repos, it'll still work if the PR branch's repo is a fork of the base one.
1 comments

No it doesn't. Here's the situation. You have an upstream repo github.com/fancyproject/fancyproject. You fork it to github.com/yourname/fancyproject. You make a branch `feature_0`, push it to yourname/fancyproject. Make a PR.

Next you create another branch `feature_1`, based on `feature_0`. You push `feature_1` to yourname/fancyproject. There is now no way to make a PR for `feature_1` that includes only the changes from feature_0 to feature_1. You can't do it because when you create the PR (in fancyproject/fancyproject) you can't select `feature_0` as a base branch because that branch doesn't exist in fancyproject/fancyproject.

Interesting.

Are you're saying that you'd want the commits for `feature_0` through `feature_1` to be in the PR (to the upstream fancyproject repo), and you'd want it to exclude the commits in the range from the fork commit through to `feature_0`?

While that's a very edge case scenario, I think (theoretically) you'd be able to do it if you first cherry-pick the commits you want onto a new branch based upon the same original fork commit that your repo forked from.

ie ensure the PR branch you create doesn't include any commits you want excluded

That should pretty much guarantee the PR goes smoothly. In theory. :)

> Are you're saying that you'd want the commits for `feature_0` through `feature_1` to be in the PR (to the upstream fancyproject repo), and you'd want it to exclude the commits in the range from the fork commit through to `feature_0`?

That's what stacked PRs are

You can review just the addition, knowing what it is building on top of.