Skip to content

git submodule upgrade

Nikolay edited this page Sep 15, 2016 · 9 revisions
  • Delete the relevant section from the .gitmodules file. The section would look similar to:
[submodule "3rd/mongoose"]
	path = 3rd/mongoose
	url = https://github.com/cesanta/mongoose.git

Command is:

git config -f .gitmodules --remove-section submodule.3rd/mongoose
  • Stage the .gitmodules changes via command line using:
	git add .gitmodules	
  • Delete the relevant section from .git/config, which will look like:
[submodule "3rd/mongoose"]
	url = https://github.com/cesanta/mongoose.git
git config -f .git/config --remove-section submodule.3rd/mongoose
  • Run:
	git rm --cached 3rd/mongoose	
  • Delete the now untracked submodule files:
	rd /S /Q 3rd\mongoose	
	git submodule add --force https://github.com/cesanta/mongoose.git 3rd/mongoose
  • Revert changes for the .gitmodules file:
	git checkout -- .gitmodules	
  • Update the submodule to specific tag:
	cd 3rd\mongoose
	git reset --hard 6.5 
  • Finally just commit the changes:
git commit -m "fix(mongoose): upgrade to v 6.5"
git push -u origin master