ColinE
ColinE

Reputation: 70142

Create a git submodule from a specific repo hash or tag

I have a project which depends on Twitter bootstrap 2.x, however, when I add bootstrap as a submodule using the following:

git submodule add https://github.com/twbs/bootstrap.git

This brings in the latest version of bootstrap.

I would like to create a submodule for a specific tag, but haven't found a way to do that. Is this possible?

Upvotes: 16

Views: 12606

Answers (1)

VonC
VonC

Reputation: 1324935

Once your submodule is created:

cd /path/to/yoursubmodule
git checkout yourTag
cd ..
git add yoursubmodule
git commit -m "use submoduile at tag xx"
git push

You records that way the fact you want a submodule at a certain tag.

Upvotes: 26

Related Questions