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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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.

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
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,927 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you