Fluffy
Fluffy

Reputation: 28362

Should I add third-party js code as a git submodule, or add it to my own repo?

As far as I know, the generally accepted practice of adding third party code like d3 is to add it as a git submodule. This reduces the size of the main repo, but I would imagine having d3 (for example) code in the main repo would help debug the cases when d3 changes breaking some code that uses it.

Are there any reasons why I should not just check out the latest version, develop my code using it, and push it to my own repository?

Upvotes: 3

Views: 234

Answers (2)

piotrek
piotrek

Reputation: 14530

the only reason is: you don't need it. just use some build tool that automatically manages your dependencies (like grunt). but if for any reason it's not an option for you than use the way that fits your needs. you can make a separate dir for 3rd party libraries and it will work. just make a way so any developer can easily find out which version is currently used (for example use version in file name)

Upvotes: 0

traviscj
traviscj

Reputation: 119

I really like using git subtree for this purpose. It allows you to keep copies of the remote repository, but still maintains that repository's history, and push/pull back and forth at will.

Upvotes: 1

Related Questions