How to Delete a Local Branch in Git

Managing branches is one of the most routine parts of working with Git. Over time, local branches accumulate — feature branches that got merged, experiments that went nowhere, hotfixes that are long since deployed. Knowing how to delete them cleanly keeps your repository organized and reduces confusion, especially when working across a team.

What a Local Branch Actually Is

In Git, a local branch is a pointer that lives only on your machine. It exists in your .git directory and has no automatic connection to any remote (like GitHub, GitLab, or Bitbucket) unless you've explicitly set one up. Deleting a local branch removes that pointer from your local repository — it does not affect anything on the remote server.

This distinction matters. A lot of confusion around branch deletion comes from mixing up local branches and remote-tracking branches, which are different things even though they often share a name.

The Standard Command to Delete a Local Branch

The most common way to delete a local branch is with the -d flag: