How to delete branch in github
Deleting a branch LOCALLY
git checkout main
Delete a branch with git branch -d <branch>
.
For example: git branch -d fix/authentication
The -d
option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D
instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.
The branch is now deleted locally.
Deleting a branch REMOTELY
Here’s the command to delete a branch remotely: git push <remote> --delete <branch>
.
For example: git push origin --delete fix/authentication
The branch is now deleted remotely.