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?
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?
1 Answer
Reset to default 4The 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
git pull --all
meansgit fetch --all
+git merge
; see git-scm/docs/git-pull#_description): "More precisely,git pull
runsgit fetch
with the given parameters and then depending on configuration options or command line flags, will call eithergit rebase
orgit merge
to reconcile diverging branches." – phd Commented Mar 18 at 6:50git push --all
which means "push all branches"git fetch --all
doesn't mean "fetch all branches"! It means "fetch all remotes"! – phd Commented Mar 18 at 6:50git pull
andgit fetch
means all remotes. The default remote isorigin
. – ElpieKay Commented Mar 18 at 7:06git help help
,git help git
,git help fetch
,git help pull
,git help push
… – phd Commented Mar 20 at 20:15