Ich klonte ein Git Repository, mainrepo
, die ein Submodul submodule1
hat. Wenn ich versuche, von submodule1
das neueste Update zu erhalten:git submodule update --remote funktioniert nicht
$ cd mainrepo
$ git submodule add [email protected]:myaccount/submodule1.git
$ git submodule update --remote submodule1
Usage: git submodule [--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>]
or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: git submodule [--quiet] init [--] [<path>...]
or: git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: git submodule [--quiet] foreach [--recursive] <command>
or: git submodule [--quiet] sync [--] [<path>...]
$ git submodule update --remote
Usage: git submodule [--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>]
or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: git submodule [--quiet] init [--] [<path>...]
or: git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: git submodule [--quiet] foreach [--recursive] <command>
or: git submodule [--quiet] sync [--] [<path>...]
Ich bin sicher, wenn ich versuchte, eine submodules
auf diese Weise zu aktualisieren, sagt der docs so zu tun, aber ich verstehe nicht, warum es nicht funktioniert.
Aber wenn ich ein Hol- und verschmelzen direkt im submodule
, wird es auf die neueste Repository aktualisiert begehen, wie ich es will:
$ cd submodule1
$ git fetch && git merge master
Warum funktioniert die submodule update --remote submodule1
Befehl Arbeit?
das könnte vielleicht helfen: https://git-scm.com/book/en/v2/Git-Tools-Submodules
Meine Vermutung ist, dass, da das Repository Sie bereits ein Submodul hat geklont (Prüfung auf:
$ vim mainrepo/.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:myaccount/mainrepo.git
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "local/src/utils"]
url = [email protected]:myaccount/submodule1.git
$ vim .gitmodules
[submodule "submodule1"]
path = submodule1
url = [email protected]:myaccount/submodule1.git
Welche Version von git ('git --version')? – larsks
Mistgit-Version auf diesem Computer ist 1.7.1 ... Die Aktualisierung der Remote-Submodule funktioniert auf meinem PC, welche Git-Version auf 2.9.0 aktualisiert wird. – kaligne