If I use an existing open source project that is hosted for example on github within one of my projects, should I check in the code from the other project into my public repo or not? I have mixed feelings about this, #1 I want to give proper credit and attribution to the original developer, and if appropriate I will contribute back any changes I need to make. However given that I have developed / tested against a specific revision of the other projects code, that is the version that I want to distribute to users of my project.

Here is the specific use case to illustrate my point. I am looking for a more generalized answer than this specific case. I am developing simple framework using rabbitmq and python for outbound messages that will allow for sending sms, twitter, email, and is extensible to support additional messaging buses as well. There is a project on github that will make the creation and sending of SMS messages developed by another person. When I create my own repo how do I account for the code that I am including from the other project?

  • Have you tried contacting the author of the open source project you are utilizing for your own project? What license does this other open source project utilize?
    – Bernard
    Jun 28, 2012 at 2:47
  • Good question @Bernard, but there is not a specific license listed on the project or in the code. I may not have phrased it well, but the question is not about licensing, it is about keeping my code in sync with the developers code. One model I could choose is to give in the installation instructions a note that the user must also install this other package, but if they install a different version than the one I had developed against, there could be bugs introduced. Does that make more sense?
    – Bryan Kemp
    Jun 28, 2012 at 2:52

2 Answers 2


Absolutely, unequivocally, if you are legally able to do so check the code into your repo.

  1. You want your builds to be hermetic, meaning that you can just type "build" in the command line and not require any additional tools, libraries, SDKs, etc.
  2. You want to insulate your build from random breaks.
  3. You want things to keep working tomorrow like they do today. This is the same as #2 but more sinister.

The best way I have seen this done is to create a third_party folder in the root of your repo, and have all references go to that. Give each third party project its own folder, and inside of it put a LICENSE and README file explaining where you got it and what you can do with it.

For example:

            ... all of its source

            ... all of its source
    ... all of your source
  • Pretty sure I can type mvn install and not have to check in and track 100 open source libraries in my own repository and the build will still work. This would be horrible if I checked out a repository and it had 100 directories under third_party with all the source for each the libraries. Sure, downloading and storing the source somewhere is nice but checking it in to the main repository? That seems like an awful idea and a problem to manage. Jun 28, 2012 at 7:17
  • @AndrewFinnell If you're going to use Maven, you're already in dependency hell, so there's no reason to keep copies of other projects' code. But I'd never build a serious project with Maven handling the dependencies unless I also had a Maven repository under my own control. Jun 29, 2012 at 22:36
  • @RossPatterson Which I do. Nexus is open source and amazing. Jun 30, 2012 at 9:33
  • this is great advice! +1
    – qodeninja
    Feb 24, 2013 at 4:33

From a technical point of view, Git has a feature called submodules that lets you incorporate a specific version of some external project into your repository. Other people who clone your repository will also get a copy of the correct version of the external project.

  • +1 for the link. I've been wondering about GitHub Submodules.
    – Jack Stone
    Jun 28, 2012 at 4:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.