What do you do with your branch after a pull request on GitHub?

My team is experimenting with using GitHub pull requests for code reviews. My only question is what do you do with the branch after you’re done? I would think you’d want to delete the branch, but since GitHub hides branches that have been merged into your current branch, it seemed like maybe I should keep it.

Just curious on what your thoughts on best practices for this are.

  • Which open-source git hosting software should I install on my company's intranet?
  • What's the best way to set up Git staging and production environments with separate databases?
  • Idea to mirror an svn to git
  • Retroactively treat line of Git commits as a branch
  • How semantic versioning fits into the git workflow
  • Why do ALL of my git repositories suddenly show that everything has been deleted?
  • Revert git remote accidentally pushed repository changes
  • Git: How can I reset a config parameter after I have accidentally changed it?
  • VS2013 git - Project marked as pending delete
  • Trying to set file name length limit with git - Permission denied
  • How to fix gem file in rails app after changing gem versions? (github, heroku)
  • Deploy Website using git
  • 3 Solutions collect form web for “What do you do with your branch after a pull request on GitHub?”

    The rule of thumb that we use (which is here some where on Stack Overflow) is “branches are for work, tags are for history”.

    Whenever a branch is merged (most likely into master) we tag the merge point using the name of the branch with the prefix “branch” (e.g. branch-topic). Then delete the branch. If we need to resurrect work at the branch point we have the tag to be able to do that.

    There are of course exceptions. We have long running branches that we use for various kinds of continuing work. But in general, topic branches are deleted after merging.

    On that note, those merges are always done with

    merge --no-ff <branch>

    This ensures that there is a merge point and a record of the merge occurring.

    Note that since April, 10th 2013, “Redesigned merge button“, the branch is deleted for you:

    new merge button

    Deleting branches after you merge has also been simplified.
    Instead of confirming the delete with an extra step, we immediately remove the branch when you delete it and provide a convenient link to restore the branch in the event you need it again.

    That confirms the best practice of deleting the branch after merging a pull request.

    I always delete branches that have been merged into master. A Git branch, after all, is a pointer to a commit, and that commit is now available in the history of another branch, so I don’t need the branch anymore. (You can always recreate the branch by looking at the parents of the merge commit.)

    Git Baby is a git and github fan, let's start git clone.