I definitely borrowed inspiration from @torek's answer. But here, I put it into action:
Start submodule
git submodule add https://github.com/dipy/dipy.git
At this point, you will see the .gitmodule
file:
[submodule "dipy"]
path = dipy
url = https://github.com/dipy/dipy.git
Adjust submodule hash:
cd dipy
git checkout 1.1.1
#confirm that you got the desired git tag
git log -1
Add the tag to main repository's git tree:
cd ../
git add dipy
git commit -m 'add dipy==1.1.1 to submodule'
Next time clone your repository and you will get the desired tag in submodule:
git clone --recurse-submodules [email protected]:pnlbwh/dMRIharmonization.git
cd dMRIharmonization/dipy
#confirm that you got the desired submodule tag
git log -1