Here's my directory structure:
root
|
\- GitRepoA
\- GitRepoB
\- GitRepoC
...
\- GitRepoN
I'm trying to effectively git pull master
or git pull main
in each of my git repos. Some of them use master
, some use main
.
I've found multiple answers to this question that should solve my problem: How do I fetch all Git branches? But they're all laden with git pull --all
, and I can't find anything about --all
existing for the pull
command.
What happened to git pull --all
and how do I achieve the same outcome it would have given me?
The git pull
option --all
was present up to Git 2.43.1. According to the release notes of Git 2.44.0, the flag --all
was removed, as the config variable fetch.all
should be favored.
"git fetch" learned to pay attention to "fetch.all" configuration variable, which pretends as if "--all" was passed from the command line when no remote parameter was given.
In your case, in order to fetch from all available remotes, just set the config variable fetch.all
to true
.
If true, fetch will attempt to update all available remotes. This behavior can be overridden by passing --no-all or by explicitly specifying one or more remote(s) to fetch from. Defaults to false.
# setting the config variable to fetch from all remotes
git config --local fetch.all true
# fetching from all available remotes
git pull
Alternatively, if you do no want to leave fetch.all
to true
, and wish to have it enabled only when you want to pull from all remotes, you could define an alias as a workaround to temporarily set fetch.all
to true
, pull from all remotes, and then reset the variable again.
# define the alias
git config --local alias.pull-all '!sh -c "git config --local fetch.all true && git pull || git config --local fetch.all false"'
# pull from all remotes
git pull-all