Normally, when you start working on some new feature, you create a new branch from the default branch (usually called
master) and work inside it.
When the work is done – you merge your branch inside
master and create a new one to work on the next feature.
Regardless of whether you are working with a local or remote Git repository, it will be a good practice to always remove unnecessary branches to prevent your repository from becoming a garbage.
Cool Tip: Have forgotten the meaning of some term in Git? Not a problem! Simply read and bookmark this article! This article →
Git – Delete Remote Branch
To remove a branch from a remote Git repository, run:
$ git push origin --delete <branch_name>
Git – Delete Local Branch
To remove a branch from a local Git repository, run:
$ git branch -d <branch_name>
Captain Obvious: To delete a branch both locally and remotely – simply run both these commands.