Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to existing Pull Requests when the target branch is deleted?

Tags:

git

github

Imagine a situation where you have 3 branches: master, my_feature, my_feature_fix.

Then the following actions are performed:

  • A Pull-Request is opened to merge my_feature_fix into my_feature.
  • In the meantime, my_feature is merged into master and the branch is deleted.

What happens to the open PR of my_feature_fix since my_feature no longer exists?

like image 617
smg Avatar asked Sep 18 '15 17:09

smg


1 Answers

Tried it out and here's what happens:

  • If my_feature is merged into master and not deleted, the open PR of my_feature_fix into my_feature remains and can still be merged into the existing my_feature branch.
  • While the my_feature_fix PR is open, the GitHub interface blocks you from deleting the my_feature branch: "You can't delete this branch because an open pull request depends on it."
  • If the branch is forcibly deleted (git branch -d my_feature), the open PR of my_feature_fix is automatically closed and labeled as "Closed with unmerged commits."
like image 148
smg Avatar answered Nov 01 '22 16:11

smg