Source branch gets deleted when the PR is merged but "close source branch" is not selected

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

  

Summary

Branch is getting deleted when PR is getting merged without enabling "close source branch"

Diagnosis

This happens when there is a remnant of the remote branch on the local. For example, if the source branch is called "develop", origin/develop remains on the remote even after the source branch gets deleted. It can also happen when the branch name is origin/develop/feature i.e. When there is a deleted branch but the remote is not completely deleted. You might also see errors like "The upstream is gone". 

Solution

This issue can be resolved with the following command - 

git remote prune origin

This will remove the errors and remove any unreferenced remote branches. 

Last modified on Dec 19, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.