From: Junio C Hamano <gitster@pobox.com>
To: "D. Ben Knoble" <ben.knoble@gmail.com>
Cc: Emily Shaffer <nasamuffin@google.com>,
Christian Fredrik Johnsen <cfj@johnsen.no>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [Feature Request] Allow batch removal of remotes with 'git remote remove'
Date: Tue, 21 Jan 2025 14:38:56 -0800 [thread overview]
Message-ID: <xmqqikq7yepr.fsf@gitster.g> (raw)
In-Reply-To: <CALnO6CAEaOUNwMpOTF8wKVd7LAv+UiU5W62ZCBc0U-K_JhHU-g@mail.gmail.com> (D. Ben Knoble's message of "Tue, 21 Jan 2025 16:32:04 -0500")
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
>> 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.
next prev parent reply other threads:[~2025-01-21 22:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 23:06 [Feature Request] Allow batch removal of remotes with 'git remote remove' Christian Fredrik Johnsen
2025-01-21 21:10 ` Emily Shaffer
2025-01-21 21:32 ` D. Ben Knoble
2025-01-21 22:38 ` Junio C Hamano [this message]
2025-01-22 2:24 ` brian m. carlson
2025-01-22 3:08 ` Jeff King
2025-01-22 16:23 ` Junio C Hamano
2025-01-22 9:40 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqikq7yepr.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=cfj@johnsen.no \
--cc=git@vger.kernel.org \
--cc=nasamuffin@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).