Branches are an essential part of contemporary version-control systems, including Git, facilitating branching workflows. Pushing our branches to remotes is a convenient way to collaborate with others and to remotely back up our work on the branch, as well as enabling pull/merge requests on collaborative platforms like GitHub and GitLab. When we are done working with our branch and it has been merged into its intended branch, eg. a default branch like
master, we can delete the branch locally and remotely, to avoid cluttering the branch namespaces.
Delete a local branch,
git branch -d feature-123-example
Delete a remote branch,
feature-123-example, from the remote,
git push origin :feature-123-example
git push origin -d feature-123-example