Thread (1 message) 1 message, 1 author, 2025-01-21

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

From: Junio C Hamano <hidden>
Date: 2025-01-21 22:38:59

"D. Ben Knoble" [off-list ref] writes:
quoted
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`.
Having to run "git remote remove" 1000 times for 1000 remotes you
happen to have may not be the best use of machine cycles.  I'd have
to think about "git config edit --local".  If you have 1000 remotes,
the chance of mistakes may be too big, as it is likely that you
would not notice if you removed unrelated things by accident.
Besides, the remote-tracking branches are left behind if you only
used "git config edit --local".
I couldn't find a comparable command beyond `git branch --delete`,
which _does_ take multiple branches.
I do not offhand think of a reason why it is a bad idea to let "git
remote remove <name>" take more than one remote names (i.e. making
it "git remote remove <name>...").  Even though it may not help if
you have 1000 remotes and want to remove all of them in one go, at
least your xargs command line invocation would become less wasteful.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help