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