Changing branches and deleting a branch in Git after a successful pull request

I created a branch "newbranch"

from master and then dropped back to the beginning. Then I created a pull request that was accepted and merged with the wizard.

At this point, should I remove "newbranch"

from my local and re pull from master to start working on something new?

What is the correct flow after the branch has been committed to master?

+3


source to share


2 answers


Once it is merged with the master, you can safely remove it.



+1


source


Update April 2013:

See " Changed the merge button " and " What do you do with the branch after pulling a request to GitHub? ":

The branch is now removed for you

new merge button


Original answer (Feb 2013)

The blog post " Cleanup After Pull Requests " is even more explicit:



The only problem is that we ended up with a lot of non-existent branches after Pull Requests were merged or closed.
From time to time one of us cleared these branches with a script, but we thought it best to take care of this step as part of our normal workflow on GitHub.com.

Starting today, after the pull request has been merged, you will see a button to delete the lingering branch:

enter image description here

The only time you don't want to delete this branch is:

  • if you intend to spend on your current patch reusing the same branch
  • or you ran multiple commits that were not merged / committed and this will be lost if you delete the branch:

If the pull request was closed without merging, the button will be slightly different to warn you about removing unrelated commits:

enter image description here

This will avoid randomness by deleting the branch too quickly.

+4


source







All Articles