Sanuj Bhadra
Sanuj Bhadra

Reputation: 139

How to setup "This branch is out-of-date with the base branch" in GitHub Repo

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?

enter image description here

Upvotes: 10

Views: 14856

Answers (3)

VonC
VonC

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

Amanda Dillon
Amanda Dillon

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:

Always suggest updating pull request branches

Require branches to be up to date before merging

Upvotes: 20

bk2204
bk2204

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

Related Questions