Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git submodule best practice

Tags:

git

github

I have a PHP project on Github that uses bootstrap... we want to submodule that. But bootstrap has other stuff inside that project that we don't need. How should I include bootstrap so that we get the right files but don't have all this extra stuff in the project (and publicly accessible from the website of anyone that installs this project)?

like image 845
William Entriken Avatar asked Dec 04 '25 18:12

William Entriken


1 Answers

The nice thing about a submodule is that it doesn't add lots of extra code to your project, code that you'll have to maintain, which I'll argue benefits you two-fold:

  1. Your developers won't have to worry about what those two or three strange files are doing in there, why they don't seem to mesh with the rest of the project, or where it came from; instead, there's this nice and tidy folder that basically acts like a symbolic link and explains all of this away
  2. You'll be able to update the ref when bootstrap is updated, which makes it easy to stay up-to-date, but only when you want to be

Remember to remind people who will clone your project that they'll need to run:

git submodule update --init

Before most anything else.

like image 165
hagemt Avatar answered Dec 07 '25 06:12

hagemt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!