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
Take the merge button configuration into consideration while merging using the cli #2954
Describe the feature or problem you’d like to solve
I'm using:
gh version 1.5.0 (2021-01-21)
https://github.com/cli/cli/releases/tag/v1.5.0
I think it will be a good feature to make the cli take the repository configuration under consideration.
For instance, the Merge button configuration, the following configuration:
Will prevent merging commits in the UI,
but if one were to merge using the cli,
then this configuration is ignored.
Today, I had a typo while working with cli:
(extra space between the pr number and the squash parameter)
gh pr merge 22 --squash
That caused the pr to be merged without being squashed first.
Proposed solution
My expectation was for an error message to be displayed,
letting me know that merging commits is disallowed.
Fixing it required me to fetch, pull, amend and force push the repository.
(extra space between the pr number and the squash parameter)
gh pr merge 22 --squash
Hmm, I find this really odd! The extra space should not matter in most shells; --squash should have been interpreted as a normal flag.
And even if you used the --merge flag instead, that would not work on the server with your repository settings, because you would have gotten an error: Merge commits are not allowed on this repository.
In my testing, I cannot use gh pr merge to bypass repository setting. Could you try again and provide us with more info?
@mislav
Thank you for your response.
I tested this again in a demo project, you are correct, I was wrong.
This was my mistake.
I seem to remember the up until recently when performing squash-&-merge on a PR with only one commit,
The commit message was used for the merge and not the pr title,
I was expecting the commit message but found the pr title was stated as the commit message.
My mistake was not checking previous commits and automatically assuming that no squash was performed.
This was o course, not the case.
This feature request can be closed.
Nevertheless,
I could swear I remember the commit message was used for squashing prs with 1 commit.
Was I mistaken?
I could swear I remember the commit message was used for squashing prs with 1 commit.
Hmm, you might be right. By default on web, it looks like the commit message is being used by default for the squashed merge, whereas in GitHub CLI, the PR title is being used by default. Perhaps we should have the same defaults as the web. I'll consider ironing this out together with changes in #2896
Activity
mislav commentedon Feb 12, 2021
Thank you for reporting!
Hmm, I find this really odd! The extra space should not matter in most shells;
--squashshould have been interpreted as a normal flag.And even if you used the
--mergeflag instead, that would not work on the server with your repository settings, because you would have gotten an error:Merge commits are not allowed on this repository.In my testing, I cannot use
gh pr mergeto bypass repository setting. Could you try again and provide us with more info?Ref. #2224
TomerFi commentedon Feb 14, 2021
@mislav
Thank you for your response.
I tested this again in a demo project, you are correct, I was wrong.
This was my mistake.
I seem to remember the up until recently when performing squash-&-merge on a PR with only one commit,
The commit message was used for the merge and not the pr title,
I was expecting the commit message but found the pr title was stated as the commit message.
My mistake was not checking previous commits and automatically assuming that no squash was performed.
This was o course, not the case.
This feature request can be closed.
Nevertheless,
I could swear I remember the commit message was used for squashing prs with 1 commit.
Was I mistaken?
mislav commentedon Feb 15, 2021
Hmm, you might be right. By default on web, it looks like the commit message is being used by default for the squashed merge, whereas in GitHub CLI, the PR title is being used by default. Perhaps we should have the same defaults as the web. I'll consider ironing this out together with changes in #2896