50% off your 1st seat of GitKraken Pro — only $4/month!

How do you delete a remote branch in Git?

Before you get into deleting remote branches in Git, we recommend you familiarize yourself with how to delete local branches.

Deleting a remote branch works a bit differently than deleting a branch locally in Git.

Deleting branches in Git is a destructive action – GitKraken enables you to perform this action safely without sacrificing speed, giving you more confidence in your workflow, whether you prefer a visual Git client or CLI.

How to Delete a Remote Git Branch with the GitKraken CLI

If you’re using the GitKraken CLI to delete your remote branch, you actually won’t be using the Git branch command to complete this action. If you run the git branch -d command associated with a remote branch, Git will tell you the branch is not found.

git delete remote branch gitkraken cli git branch -d

Rather than using the Git branch command, you will be using the Git push command to delete the remote branch.

You will need to tell Git which remote repository you want to work with, followed by the --delete flag, followed by the branch name.

It should look something like this:

$ git push <name-of-remote-repository> --delete <branch-name>
git delete remote branch gitkraken cli git push --delete

How to Find a List of Your Remote Git Branches

If you’re using a terminal to view a list of your remote branches in Git, you will need to run git branch -r.

git delete remote branch gitkraken cli view remote branches

Deleting remote branches without enough visibility into your repo can be dangerous. Reduce the risk of losing work or putting your repo in a bad state and get more control of your remote branches with GitKraken.

How to Delete a Remote Branch with GitKraken Client

Because deleting a remote branch is a destructive action, leaning on the visual benefits offered by GitKraken can be beneficial for beginners and experts alike. 

From the main UI, you can quickly see a list of your remote branches in the left panel under REMOTE, organized conveniently beneath the related remote repository name. 

ProTip: if you have a large number of branches on one of your remotes, you can use Cmd + Option + f on Mac, or Ctrl + Alt + f on Windows/Linux to filter for a specific branch from the left panel. 

delete remote git branch view remote git branches in gitkraken

To delete a remote branch, you will simply right-click on the target branch from the central commit graph or the left panel and then select Delete <remote-branch-name> from the context menu. 

Remember when we said this was a destructive Git action? To be extra cautious, GitKraken will ask that you confirm before proceeding, giving you and your team peace of mind. 

Want to make working with remote branches in Git easier? Download the GitKraken Git Client, now with GUI and CLI, free today.

Additional Resources

Table of Contents

Make Git Easier, Safer &
More Powerful

with GitKraken

Visual Studio Code is required to install GitLens.

Don’t have Visual Studio Code? Get it now.