How to Delete Branch in GIT

  • Switch to some other branch first
git checkout <some-other-branch-name>
  • Delete remote branch
git push origin --delete <branch_name>
  • Delete local branch now (This command will fail, if there is any pending work to be committed / merged)
git branch -d <branch-name-to-delete>
  • Delete local branch forcefully irrespective of merge status
git branch -D <branch-name-to-delete>
OR
git branch --delete --force <branch-name-to-delete>

* The Content stated above is for informational purpose only. Expert Software Team is not responsible if any part of content found meaningless in any manner or condition.

Leave a Reply

Your email address will not be published. Required fields are marked *