How to delete a GIT branch
Delete a Local Branch:
To delete the local branch, use one of the following:
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. - The
-D
option is an alias for--delete --force
, which deletes the branch "irrespective of its merged status." [Source:man git-branch
]
Delete Remote Branch
As of Git v1.7.0, you can delete a remote branch using
$ git push <remote_name> --delete <branch_name>
No comments