Reputation: 139
Whenever the master branch is updated I want all open pull requests to show the option of Update branch as shown below. How do I do that?
Upvotes: 10
Views: 14856
Reputation: 1327324
Note: with gh 2.21.0 (Dec. 2022), you can set the option "Always suggest updating pull request branches
" from command line with gh repo edit
gh repo edit --allow-update-branch
You can install gh
first, with manual installation or using winget
:
winget install GitHub.cli
Upvotes: 0
Reputation: 676
As of February 2022 this is possible without having the "Require branches to be up to date before merging" setting on.
The new setting is called "Always suggest updating pull request branches".
See the Github blog post on More ways to keep your pull request branch up-to-date, especially the section on "Always have the option to update".
Both can be updated in settings:
Upvotes: 20
Reputation: 76804
This configuration is part of the protected branches option. You can create a protected branch in the repository settings and then select “Require status checks to pass before merging” and then “Require branches to be up to date before merging.”
Note that this option is the only way to get this button; if you don't want to prevent people from merging out-of-date branches, then this button won't be available. I generally recommend not setting this option unless you have a good reason since it can make merging changes difficult if someone else merges before you, especially on busy repositories.
Upvotes: 9