Solutions to Git Problems

Git Branch

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.

If you run the git branch -d command associated with a remote branch, Git will tell you the branch is not found.

You actually won’t be using the git branch command to delete a remote branch. Instead, you will be using the git push command.

Next, 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>

How do you find a list of your remote branches in Git?

If you don’t have the visual benefit of the GitKraken Git client which displays your remote branches, you will need to run git branch -r to get a list of the remote branches in your Git repository.

Want to make working with remote branches in Git easier? Download the GitKraken Git GUI for free.