Stefan Kendall
Stefan Kendall

Reputation: 67892

Add git submodule with files?

Is there a way to add a git submodule with all of its files? I really just need the files as a subdirectory with an easy way to run the update with git fetch and git pull.

I tried git cloning the repository but that added the directory as a submodule without the files.

Upvotes: 1

Views: 96

Answers (2)

jhnphm
jhnphm

Reputation: 66

Perhaps you want git subtree merge?

Something like:

git subtree add --prefix [submodule name] [submodule url] master

See http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/

Upvotes: 1

VonC
VonC

Reputation: 1329102

You should see the submodule files after:

 cd /path/to/parent/repo/already/cloned
 git submodule update --init

Or, in one command, you can clone the parent repo and the submodules with:

git clone --recursive /url/parent/repo

Upvotes: 0

Related Questions