Back to all tips

Git Noob Tips

Delete Remote Branch

🗓️ Published: 4/22/2022

Deleting a local branch is rather easy:

git branch -d <branch>

The -d flag checks if the branch is merged and then deletes it. To delete a local branch no matter what, we have to use the big D:

git branch -D <branch>

Then, it comes to deleting a remote branch from git's CLI:

git push origin --delete <branch>

Of course, one can delete a remote branch using the UI application that manages the remote repo, e.g. GitHub or GitLab. But this is handier.

Also, to check what remote branches there are, you can list them using:

git branch --remote

Discuss this tip on