How to delete a Git branch both locally and remotely?
How to delete a Git branch both locally and remotely?. Here is very simple commands for you to delete the existing branch on local and remote server. Let’s start with local branches, Deletion command for Local system branch delete :
$ git branch -D branchname Deleted branch branchname
Here gi branch -D is the syntax and followed by the branch name which you want to delete. That’s it. to delete locally, but for the remote server, we need to delete with the following command, many people stuck with the issue of remote deletion. sometimes it wont work properly. Don’t worry here is the command which will work surely.
git push origin --delete branchName
git push origin : branchName
That’s it to delete the branches on remote server and local server. and one another approach is there, but it was older one, you can try this too.
git push --prune origin