To delete a Git branch locally, you can use the git branch command with the -d flag, followed by the name of the branch you want to delete. For example:

git branch -d branch_name

This will delete the specified branch if it has already been fully merged into the current branch. If the branch has not been fully merged, you can use the -D flag instead, which will force the deletion of the branch.

To delete a Git branch remotely, you can use the git push command followed by the name of the remote repository and the name of the branch you want to delete, prefixed with a :. For example:

git push origin :branch_name

This will delete the specified branch from the remote repository. Note that you will not be able to delete a branch that you are currently on. To delete a branch that you are currently on, you will need to switch to a different branch first.

It’s generally a good idea to double-check that you really want to delete a branch before doing so, as once a branch is deleted, the changes made in that branch are lost forever.