Skip to content

Instantly share code, notes, and snippets.

@anandjagadeesh
Last active September 13, 2020 12:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?

To delete any branch, you shouldn't be on that branch, so switch to another branch before giving the commands

To delete any branch run,

git branch --delete <branch_name>
or
git branch -d <branch_name>

But this fails if the branch hasn't been merged, so to force delete, if required, run,

git branch --delete --force <branch_name>
or
git branch -D <branch_name>

To delete the remote branch, you need to run,

git push origin --delete <branch_name>
or
git push origin :<branch_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment