Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

What happens to the Git branch when a pull request is declined?

Harrison McCullough October 16, 2020

What happens to the associated Git branch when a pull request is declined? I believe the documentation says that nothing happens to the underlying repository.

What happens if the branch is later deleted? Will the pull request still "hold on" to the code that was supposed to be merged? Or will Git eventually garbage collect them if no branches/tags reference the changed code?

In case it's helpful, I'm wondering what will happen if these steps happen:

  1. Branch is created
  2. Commits are added to the branch
  3. Pull request is created based on the branch
  4. Pull request is declined
  5. The branch is deleted on the server

1 answer

1 accepted

1 vote
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2020

If you delete a branch that have not been merged, as in the scenario of a pull request being declined, your commits would also be lost. So the only thing the pull request would hold on to would be the commits, but since those have been deleted you would not be able to reopen or view the code changes. This is why Bitbucket gives you a warning when deleting a branch with commits that you will lose those changes too.

Harrison McCullough October 16, 2020

That's what I assumed. Thank you for confirming!

Like Mikael Sandberg likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events