Commands to delete local & remote git branches – Code Example

Total
0
Shares

In this article we will show you the commands to delete git branch locally and remotely.

Local Branch Delete –

git branch -d <branch_name>

For force delete –

git branch -D <branch_name>

Remote Branch Delete –

git push origin -d <branch>

Local remote-tracking branch Delete –

git branch -dr <remote>/<branch>

Deleting obsolete remote tracking branches –

git fetch <remote> -p