Delete a Git branch both locally and remotely

Delete Remote Branch

$ git push <remote_name> --delete <branch_name>

Delete Local Branch

$ git branch -d branch_name
$ git branch -D branch_name

The -d option is an alias for --delete, which only deletes the branch if it has already been fully merged in its upstream branch. You could also use -D, which is an alias for --delete --force, which deletes the branch "irrespective of its merged status.

Post a Comment

Featured Post

Updated Coupons / promo codes for Google Apps for Work / Business

To redeem: 1. Sign up for Google Apps   2. Go to your billing settings  3. Choose your payment plan  4. Enter your promo code ...