Yusuf
Yusuf

Reputation: 449

GitHub - PR linked issue does not gets closed when non-default branch is merged with main

I have main as default branch and dev as non-default.

I created one issue and one PR to merge from new temp branch to dev branch In PR, I have mentioned Resolves #1.

When I merge PR to dev branch, the issue #1 does not gets closed as it is non-default branch.

Then I using git commandline inside main branch, I did git merge dev so dev branch is merged to main.

In main branch commits, I can see the Merge pull request ... commit as well.

But the issue #1 does not gets closed even as PR is indirectly merged to main (from temp to dev to main)

Any reasons for the bug ?

Update: - When merging dev to main , next time I did not used git merge dev on main branch, but I created new PR to merge dev to main.

And it closes the issue.

Why I worked while merging with PR and not when git merge is used ?

Upvotes: 4

Views: 2005

Answers (1)

Julian
Julian

Reputation: 36770

Unfortunately this is by design and not a bug

When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed

And

Note: The special keywords in a pull request description are interpreted when the pull request targets the repository's default branch. However, if the PR's base is any other branch, then these keywords are ignored, no links are created and merging the PR has no effect on the issues. If you want to link a pull request to an issue using a keyword, the PR must be on the default branch.

From https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue

PS: I have emailed GitHub support also for this in the past. Unfortunately is hasn't changed (yet)

Upvotes: 12

Related Questions