Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you need to commit a git submodule or just the gitmodules file

Tags:

git

When you add a submodule to your git project - it adds a gitmodules file and pulls down the actual submodule and stores it in your project.

Do I need to commit the actual submodule that's pulled down or is it better to just commit the gitmodules file that describes the path to the submodule?

like image 570
Ogen Avatar asked Mar 12 '18 03:03

Ogen


1 Answers

You will commit automatically both:

  • the .gitmodule
  • the gitlink (special entry in the index of the main repo) which records the SHA1 of that submodule.

This is reflected in the reverse process (when you want to remove a submodule from a Git repo)

like image 189
VonC Avatar answered Sep 18 '22 17:09

VonC