If you are not using a gui for github like Sourcetree or Github desktop but you prefer using git from console then you might might wondering how you can delete a branch both from server/remote and from local. The commands you can use are the following:
To delete the local branch use:
git branch -d <local_branch_name>
If you use -D
, which is an alias for --delete --force
, which deletes the branch “irrespective of its merged status.”
And to delete the remote branch you can use:
git push origin --delete <remote_branch_name>