git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Feature Request] Allow batch removal of remotes with 'git remote remove'

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Jan 21, 2025, 21:32 UTC
Message-ID
<CALnO6CAEaOUNwMpOTF8wKVd7LAv+UiU5W62ZCBc0U-K_JhHU-g@mail.gmail.com>
In-Reply-To
<CAJoAoZnecm5y8243R9JsGjRDuv-Mb=UAwa+Hbj5CKDKNPBLB4g@mail.gmail.com>
On Tue, Jan 21, 2025 at 4:16 PM Emily Shaffer <nasamuffin@google.com> wrote:
Show 21 quoted lines
>
> On Mon, Jan 20, 2025 at 3:07 PM Christian Fredrik Johnsen
> <cfj@johnsen.no> wrote:
> >
> > Hello 😃
> >
> > I would like to propose a feature enhancement to the 'git remote remove' command.
> >
> > --- The Problem ---
> > Currently, 'git remote remove' only supports removing one remote at a time. However, it would be useful to allow batch removal of remotes, as in:
> >
> > `git remote remove remote1 remote2 remote3`
> >
> > This would simplify workflows for repositories with multiple remotes when clean-up operations are needed.
>
> Hi Christian, is there a reason why opening up the config (`vim
> .git/config` or `git config edit --local`) and batch-deleting remotes
> from there is undesirable? If this is a solution you believe only
> power users need, then I'd posit a power user can both list all
> remotes *and* remove the offending ones in a single editor pass,
> rather than having to run multiple `git remote` commands, anyway.

I'd posit a power user can also do something a bit like (Zsh with GNU or FreeBSD xargs) `print -N my remotes to delete | xargs -0n1 git remote remove`, or (portably) `for remote in my remotes to delete; do git remote remove "$remote"; done`.

I couldn't find a comparable command beyond `git branch --delete`, which _does_ take multiple branches.

-- 
D. Ben Knoble
Previous: Emily ShafferNext: Junio C Hamano
Message 3 of 8 in “[Feature Request] Allow batch removal of remotes with 'git remote remove'”
  1. Christian Fredrik JohnsenJan 20, 2025
  2. Emily ShafferJan 21, 2025
  3. D. Ben KnobleJan 21, 2025
  4. Junio C HamanoJan 21, 2025
  5. brian m. carlsonJan 22, 2025
  6. Jeff KingJan 22, 2025
  7. Junio C HamanoJan 22, 2025
  8. Patrick SteinhardtJan 22, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.