**Refference: **
- https://github.blog/2016-02-01-working-with-submodules/
- https://www.youtube.com/watch?v=eJrh5IjWSGM
- https://www.youtube.com/watch?v=ZYq3NJnO08U
- https://www.youtube.com/watch?v=OD4YC9zvt1g
Key Command:
- add submodules:
git submodule add https://github.com/<user>/rock rock - update submodules:
git submodule update --init --recursive - clone repo that has submodules:
git clone --recursive <project url>
Git Submodule
Let’s say you’re working on a project called Slingshot. You’ve got code for y-shaped stick and a rubber-band. At the same time, in another repository, you’ve got another project called Rock—it’s just a generic rock library, but you think it’d be perfect for Slingshot. You can add rock as a submodule of slingshot. In the slingshot repository:
git submodule add https://github.com/<user>/rock rock
At this point, you’ll have a rock folder inside slingshot, but if you were to peek inside that folder, depending on your version of Git, you might see … nothing.
Newer versions of Git will do this automatically, but older versions will require you to explicitly tell Git to download the contents of rock:
git submodule update --init --recursive
If everything looks good, you can commit this change and you’ll have a rock folder in the slingshot repository with all the content from the rock repository.
On the command line, Git commands issued from slingshot (or any of the other folders, rubber-band and y-shaped-stick) will operate on the “parent repository”, slingshot, but commands you issue from the rock folder will operate on just the rock repository:
cd ~/projects/slingshot
git log # log shows commits from Project Slingshot
cd ~/projects/slingshot/rubber-band
git log # still commits from Project Slingshot
cd ~/projects/slingshot/rock
git log # commits from Rock
Create React Symbolic Link:
ref: https://ismayilkhayredinov.medium.com/symlinking-react-libraries-for-local-development-bcecef2a4d01