5.5 Deleting Branches

Branches can outlive their usefulness. The release was tagged; the experiment was proven successful or failed. When this happens, you should delete the branch to keep your repository’s branches from growing out of control.

After you merge your changes back into your current branch, such as the about2 branch you created, you can use the -d parameter on git branch to delete the old branch:

 
​prompt> git branch -d about2
 
​Deleted branch about2.​

This works only when the branch you’re trying to delete has been successfully merged into the current branch you are on. To demonstrate this, let’s switch back to the master branch. Remember, we haven’t merged any of our changes from the about branch yet. ...

Get Pragmatic Version Control Using 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.