17 Deleting Branches

Branches can, and normally do, outlive their usefulness. Once you no longer need one, you can delete it from your repository. Remember, branches in Git are pointers to a commit. Deleting a branch doesn’t delete any commits, just the named pointer that refers to that commit.

One area where Git differs from traditional version control systems is the expense related to creating and deleting branches. It’s common to leave branches such as a release branch in the repository indefinitely in Subversion. Git doesn’t require that.

Since tags and branches both point to a single commit, you can tag your release and then delete the release branch. You can always create a new branch from the tag later if you need to make ...

Get Pragmatic Guide to Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.