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
I would actually like a setting on the project to where we can enable automerge always from select users (like dependabot where github would merge it for me)
Currently I had to make an automerge workflow in github actions to do that when all of the checks pass.
@amansilla No, we've opted to not add the --auto flag to gh pr create. You may separately enable auto-merge for your new PR with the gh pr merge --auto command after running gh pr create.
Reacted by Antoine Méausoone, Edgar Ramírez Mondragón, Francesc Esplugas, Cyril Quinton, Beto Aveiga, Jon Lauridsen, Jeff Mark, Vitali Plagov, Efeturi Money and Allon Guralnek
Reacted by Alex Tsoi, Johannes Rieken, ilian, Shawn Erquhart, Beto Aveiga, Nick McCullum, Andrew Magee, Serhii Zolotov, Chidi Williams, Ishaan Gandhi and 3 more
@amansilla No, we've opted to not add the --auto flag to gh pr create. You may separately enable auto-merge for your new PR with the gh pr merge --auto command after running gh pr create.
does that support telling it how it must merge it (like rebase merge for example) too?
When I run gh pr merge --auto, it still prompts me for how it should merge. Do I need to always use gh pr merge --auto --merge? I'm using this in a CICD.
boo, it's not like git where we can configure gh config pr.mergeStrategy commit/squash/rebase (which I think would be much better to do to define a default for when one does not explicitly declare it (to use the one from config in that case).
it's not like git where we can configure gh config pr.mergeStrategy
Does git have a configuration option for a default merge strategy? Would you mind pointing it out to me? I can't see it in git help—the option pr.mergeStrategy does not exist, which makes sense because git has no concept of "Pull Requests".
We might add a config option in the future, but we will first have to also enable repository-specific config for gh, which we don't have right now. Otherwise, a locally configured default merge strategy will work for some repos but not for others, since GitHub repos can prohibit certain merge strategies in their settings.
In the meantime, feel free to create a gh alias with your favorite merge strategy:
@amansilla No, we've opted to not add the --auto flag to gh pr create. You may separately enable auto-merge for your new PR with the gh pr merge --auto command after running gh pr create.
Please reconsider this decision. Running gh pr merge --auto immedately after gh pr create sometimes results in the following error:
no pull requests found for branch "test-branch"
I can avoid detecting the PR number from the branch name by capturing the created PR URL returned by gh pr create and providing it as an argument to gh pr merge:
This is also not reliable, as this sometimes fails with the following error:
GraphQL: Could not resolve to a PullRequest with the number of 183. (repository.pullRequest)
I suspect that the API used by gh pr create returns before the newly created PR is propagated to the entire system. The second command might interact with an API endpoint that does not yet know about the existence of the newly created PR.
I currently have to resort to a wait and retry mechanism in our CI/CD pipeline as a workaround, but it would be great if this is resolved on the API or CLI side.
Reacted by Su Khai Koh, Enrico Rotundo, James, Monde, Jake Adams, Andrew Magee, Sandip Chatterjee, Sebastian Häni, Armen Markossyan, Remy and 10 more
To add to this, when a branch has protections requiring a review the gh pr merge command fails out with: Message: At least 1 approving review is required by reviewers with write access., Locations: [{Line:1 Column:58}]
If the gh create had the option, this error would not be thrown because it would not try to merge until the review came in.
Is there another work around? Will we just need to create another workflow to trigger when a review happens?
No, we've opted to not add the --auto flag to gh pr create. You may separately enable auto-merge for your new PR with the gh pr merge --auto command after running gh pr create.
Why? just let people enable it with one command IMO. Why say no to making your CLI more convenient for your users?
No, we've opted to not add the --auto flag to gh pr create. You may separately enable auto-merge for your new PR with the gh pr merge --auto command after running gh pr create.
Why? just let people enable it with one command IMO. Why say no to making your CLI more convenient for your users?
Hi @iway1 this issue is pretty old and I don't see any of the current maintainers' names in this thread. None of the maintainers in this thread are GitHub staff anymore, so I suspect I'm not alone saying I don't have the full context behind the decision at a glance.
I recommend opening a new issue that links back to this one, including your use cases and reasoning in that new issue, if you feel we should re-evaluate this previous decision. That'll get fresh eyes on it 😁
Activity
tonytonyjan commentedon Feb 7, 2021
Really need this on
gh pr createandgh pr merge.AraHaan commentedon Feb 7, 2021
I would actually like a setting on the project to where we can enable automerge always from select users (like dependabot where github would merge it for me)
Currently I had to make an automerge workflow in github actions to do that when all of the checks pass.
amansilla commentedon Nov 22, 2021
I think the
autooption is still missing ongh pr createcommand. Is this supposed to be implemented?mislav commentedon Nov 23, 2021
@amansilla No, we've opted to not add the
--autoflag togh pr create. You may separately enable auto-merge for your new PR with thegh pr merge --autocommand after runninggh pr create.amansilla commentedon Nov 23, 2021
All right @mislav! Thanks for the clarification.
AraHaan commentedon Nov 23, 2021
does that support telling it how it must merge it (like rebase merge for example) too?
mislav commentedon Nov 23, 2021
@AraHaan Yes; please refer to
gh pr mergedocumentation.CMCDragonkai commentedon May 23, 2022
When I run
gh pr merge --auto, it still prompts me for how it should merge. Do I need to always usegh pr merge --auto --merge? I'm using this in a CICD.mislav commentedon May 23, 2022
@CMCDragonkai Yes, you have to explicitly declare a merge strategy.
AraHaan commentedon May 23, 2022
boo, it's not like git where we can configure
gh config pr.mergeStrategy commit/squash/rebase(which I think would be much better to do to define a default for when one does not explicitly declare it (to use the one from config in that case).mislav commentedon May 24, 2022
Does git have a configuration option for a default merge strategy? Would you mind pointing it out to me? I can't see it in git help—the option
pr.mergeStrategydoes not exist, which makes sense because git has no concept of "Pull Requests".We might add a config option in the future, but we will first have to also enable repository-specific config for gh, which we don't have right now. Otherwise, a locally configured default merge strategy will work for some repos but not for others, since GitHub repos can prohibit certain merge strategies in their settings.
In the meantime, feel free to create a gh alias with your favorite merge strategy:
ilian commentedon Sep 8, 2022
Please reconsider this decision. Running
gh pr merge --autoimmedately aftergh pr createsometimes results in the following error:I can avoid detecting the PR number from the branch name by capturing the created PR URL returned by
gh pr createand providing it as an argument togh pr merge:This is also not reliable, as this sometimes fails with the following error:
I suspect that the API used by
gh pr createreturns before the newly created PR is propagated to the entire system. The second command might interact with an API endpoint that does not yet know about the existence of the newly created PR.I currently have to resort to a wait and retry mechanism in our CI/CD pipeline as a workaround, but it would be great if this is resolved on the API or CLI side.
blchilders commentedon Sep 21, 2022
To add to this, when a branch has protections requiring a review the
gh pr mergecommand fails out with:Message: At least 1 approving review is required by reviewers with write access., Locations: [{Line:1 Column:58}]If the gh create had the option, this error would not be thrown because it would not try to merge until the review came in.
Is there another work around? Will we just need to create another workflow to trigger when a review happens?
iway1 commentedon Jun 26, 2025
Why? just let people enable it with one command IMO. Why say no to making your CLI more convenient for your users?
BagToad commentedon Jun 26, 2025
Hi @iway1 this issue is pretty old and I don't see any of the current maintainers' names in this thread. None of the maintainers in this thread are GitHub staff anymore, so I suspect I'm not alone saying I don't have the full context behind the decision at a glance.
I recommend opening a new issue that links back to this one, including your use cases and reasoning in that new issue, if you feel we should re-evaluate this previous decision. That'll get fresh eyes on it 😁