Is it possible to have configured remotes in git that are only fetched when formally requested by its name? So they would be excluded of operations like fetch --all
.
Imagine a dormant (disabled, or something) remote called "my-no-auto-fetch-remote":
$ git fetch my-no-auto-fetch-remote
(it's fetched)
$ git fetch --all
(the my-no-auto-fetch-remote shouldn't be fetched)
There is a configuration skipFetchAll
for remotes.
From the documentation on: https://git-scm.com/docs/git-config/1.9.2
remote..skipFetchAll
If true, this remote will be skipped by default when updating using git-fetch[1] or the update subcommand of git-remote[1].
As there is no option at command line when adding or changing a remote, I had to put that configuration editing the .git/config
file, as:
[remote "my-remote"]
url = git@the-repository-url
fetch = +refs/heads/*:refs/remotes/my-remote/*
skipFetchAll = true
You can add this from the command-line using
git config remote.my-remote.skipFetchAll true
where my-remote
is the remote name that should be excluded from git fetch --all
.
Not really, no: --all
means all. But you can define remote groups, and use git remote update
to update the groups. Put the normally-unavailable remote into a group that's not the default group. See the git remote
documentation for details.
(git fetch
also works with groups, I just prefer to use git remote
when dealing with groups and git fetch
for one individual remote, myself. Probably a holdover from a decade-plus ago...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With