# Feature Request: `git remote prune --all`

3 messages from 2014-08-17 to 2014-08-18. Participants: Travis Carden, Jeff King.
Thread: https://gitlist.dev/t/37364

## Travis Carden, 2014-08-17 00:52

Subject: Feature Request: `git remote prune --all`
Message-ID: <CAByVDef1_7x8Q1SL5wMtrKJQE51gvEOiKJ4xkpexXN5omBDn-Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAByVDef1_7x8Q1SL5wMtrKJQE51gvEOiKJ4xkpexXN5omBDn-Q%40mail.gmail.com

```
I would like to propose the addition of a `git remote prune --all`
command option or similar mechanism for pruning all remotes in a
repository. For lack of such a feature, I've been using the following
bash alias:

alias git-remote-prune-all='for REMOTE in `git remote`; do echo
"Pruning $REMOTE"; git remote prune $REMOTE; done;'

```

## Jeff King, 2014-08-17 07:18

Subject: Re: Feature Request: `git remote prune --all`
Message-ID: <20140817071805.GC23808@peff.net>
URL: https://gitlist.dev/e/20140817071805.GC23808%40peff.net
In-Reply-To: <CAByVDef1_7x8Q1SL5wMtrKJQE51gvEOiKJ4xkpexXN5omBDn-Q@mail.gmail.com>

```
On Sat, Aug 16, 2014 at 07:52:44PM -0500, Travis Carden wrote:

> I would like to propose the addition of a `git remote prune --all`
> command option or similar mechanism for pruning all remotes in a
> repository. For lack of such a feature, I've been using the following
> bash alias:
> 
> alias git-remote-prune-all='for REMOTE in `git remote`; do echo
> "Pruning $REMOTE"; git remote prune $REMOTE; done;'

I think in general we've been moving "git remote" away from actually
interacting with the other side, and pushing those features into "git
fetch". These days you can use "git fetch --prune --all" to do what you
want.

Note that this isn't _exactly_ the same thing. Fetch's prune will do a
normal fetch and _also_ prune. There is no way to say "just prune, but
do not update existing refs". If that detail is important, I think I'd
rather see the feature go the other way from your request: teach
git-fetch a "--prune-only" mode.

-Peff

```

## Travis Carden, 2014-08-18 05:56

Subject: Re: Feature Request: `git remote prune --all`
Message-ID: <CAByVDedhkUgXkey9dkPYxVQqvzRW4D9OOXt4uFa74+7PvX0mjA@mail.gmail.com>
URL: https://gitlist.dev/e/CAByVDedhkUgXkey9dkPYxVQqvzRW4D9OOXt4uFa74%2B7PvX0mjA%40mail.gmail.com
In-Reply-To: <20140817071805.GC23808@peff.net>

```
Thanks, guys! `git fetch --all --prune` satisfies my request. I
appreciate the education!

On Sun, Aug 17, 2014 at 2:18 AM, Jeff King <peff@peff.net> wrote:
> On Sat, Aug 16, 2014 at 07:52:44PM -0500, Travis Carden wrote:
>
>> I would like to propose the addition of a `git remote prune --all`
>> command option or similar mechanism for pruning all remotes in a
>> repository. For lack of such a feature, I've been using the following
>> bash alias:
>>
>> alias git-remote-prune-all='for REMOTE in `git remote`; do echo
>> "Pruning $REMOTE"; git remote prune $REMOTE; done;'
>
> I think in general we've been moving "git remote" away from actually
> interacting with the other side, and pushing those features into "git
> fetch". These days you can use "git fetch --prune --all" to do what you
> want.
>
> Note that this isn't _exactly_ the same thing. Fetch's prune will do a
> normal fetch and _also_ prune. There is no way to say "just prune, but
> do not update existing refs". If that detail is important, I think I'd
> rather see the feature go the other way from your request: teach
> git-fetch a "--prune-only" mode.
>
> -Peff

```
