You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Infer what branch should be used as the compare branch (NDDB) #4766
In order to notify users that their current branch is behind, we need some way to determine which branch to use as the compare branch.
Criteria to determine compare branch (in priority order)
If the current branch has a PR associated with it, use the target branch of the PR (this can be a branch that exists on eitherupstream ororigin)
If the repository is a fork, use the default branch on upstream(this is usually master)
If the repository is hosted on GitHub, use the default branch on origin(this is usually master)
Otherwise fall through to the local master branch (conventionally, the default branch is master)
Notes on criteria
Criterion 1 and 3 are the most important ones to capture. Most times, the base branches of these two will be equivalent, origin/master.
Criteria 2 will likely be the most difficult as their are some edge cases we need to worry about. As I understand it, GitHub users create forks for two reasons:
To have a starting point for their own ideas
To propose changes to the repository they are forking from
We need to make sure we are careful to support both of these use-cases. We should be able to handle this by:
Checking the default branch on the forked repository (likely origin/master)
If no changes are found after performing step 1, check the default branch of the parent repository (likely upstream/master)
changed the title [-]Infer what branch should be used as the base branch (NDDB)[/-][+]Infer what branch should be used as the compare branch (NDDB)[/+]on May 23, 2018
Activity
[-]Infer what branch should be used as the base branch (NDDB)[/-][+]Infer what branch should be used as the compare branch (NDDB)[/+]