How to delete a Git branch locally and remotely

Delete a Git branch locally and remotely

Delete Git branch locally (Be careful, your code or data will be lost):

# method 1
git push -d your_local_branch_name

# method 2
git push -D your_local_branch_name
  • is an alias for , which delete only local branches
  • is the alias for , even if this branch hasn't been merged or pushed.