goh
goh

Reputation: 29511

unable to update submodule

I want to update my submodule on my local machine to the latest revision of the super repository. Currently I have

git submodule status
 257a40757014ca5a2e8b500d2eb3000cb6628094 common (heads/master)

I tried git submodule update, but it wasn't even trying to contact the remote machine:

[submodule "common"]
        url = ssh://foo.com:22/home/bar/webapps/git/repos/common.git

what's wrong?

Upvotes: 4

Views: 929

Answers (2)

matpie
matpie

Reputation: 17512

You need to cd in to the submodule directory and run a git pull first. Then, cd to your super repository and git add [submodule folder] to update the ref.

See Git Book - Submodules.

Upvotes: 2

VonC
VonC

Reputation: 1323333

You need to make that update from within the submodule.
And then go back one level and commit from the parent repo.

Your git submodule update was just about asking the parent repo to check if the submodule had the content 257a40757. It had, so no connection was necessary.

Since a submodule is its own git repo, you need to update that repo first, then record the new updated state of said submodule in the parent repo.

Upvotes: 3

Related Questions