# cannot remove remote branch name

3 messages from 2010-01-05 to 2010-01-05. Participants: SungHyun Nam, Erik Faye-Lund, Junio C Hamano.
Thread: https://gitlist.dev/t/22096

## SungHyun Nam, 2010-01-05 01:57

Subject: cannot remove remote branch name
Message-ID: <hhu694$3v9$1@ger.gmane.org>
URL: https://gitlist.dev/e/hhu694%243v9%241%40ger.gmane.org

```
Hello,

How I can remove remote branch name if it already removed
in remote side?

$ git branch -a
* master
   remotes/origin/HEAD -> origin/master
   remotes/origin/master
   remotes/origin/test
$ git branch -D -r test
error: remote branch 'test' not found.
$ git branch -D -r remotes/origin/test
error: remote branch 'remotes/origin/test' not found.
$ git branch -D remotes/origin/test
error: branch 'remotes/origin/test' not found.

The 'remotes/origin/test' was removed in remote side.

Thanks,
namsh

```

## Erik Faye-Lund, 2010-01-05 01:59

Subject: Re: cannot remove remote branch name
Message-ID: <40aa078e1001041759p22657d0cwe094a348dca32842@mail.gmail.com>
URL: https://gitlist.dev/e/40aa078e1001041759p22657d0cwe094a348dca32842%40mail.gmail.com
In-Reply-To: <hhu694$3v9$1@ger.gmane.org>

```
On Tue, Jan 5, 2010 at 2:57 AM, SungHyun Nam <goweol@gmail.com> wrote:
> Hello,
>
> How I can remove remote branch name if it already removed
> in remote side?
>
> $ git branch -a
> * master
>  remotes/origin/HEAD -> origin/master
>  remotes/origin/master
>  remotes/origin/test
> $ git branch -D -r test
> error: remote branch 'test' not found.
> $ git branch -D -r remotes/origin/test
> error: remote branch 'remotes/origin/test' not found.
> $ git branch -D remotes/origin/test
> error: branch 'remotes/origin/test' not found.
>
> The 'remotes/origin/test' was removed in remote side.
>

$ git remote prune origin

-- 
Erik "kusma" Faye-Lund

```

## Junio C Hamano, 2010-01-05 02:18

Subject: Re: cannot remove remote branch name
Message-ID: <7vskal9tvu.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vskal9tvu.fsf%40alter.siamese.dyndns.org
In-Reply-To: <hhu694$3v9$1@ger.gmane.org>

```
SungHyun Nam <goweol@gmail.com> writes:

> How I can remove remote branch name if it already removed
> in remote side?
>
> $ git branch -a
> * master
>   remotes/origin/HEAD -> origin/master
>   remotes/origin/master
>   remotes/origin/test
> $ git branch -D -r test
> error: remote branch 'test' not found.
> $ git branch -D -r remotes/origin/test
> error: remote branch 'remotes/origin/test' not found.
> $ git branch -D remotes/origin/test
> error: branch 'remotes/origin/test' not found.

Hmm, you tried "test" and then "remotes/origin/test"?

The way I would have guessed what to give the command is:

 1. "branch -D -r test" wouldn't make sense, as git wouldn't know 'test'
    of which remote I am trying to remove;

 2. "-r" already tells git that I am talking about remote, so perhaps
    "branch -D -r origin/test" would work without me saying "remotes/".

"git branch -[dD]" doesn't go over the network, so it doesn't matter if it
is already removed on the remote side or not.

```
