4

When you are working with an external library in git, should you add it to Git or should it be in gitignore? If you put it in gitignore, you run into the problem that if someone (or you yourself on another PC) wants to work on your code, they will first have to download and link the library. If you do include it, the graph of code activity will show 22k lines of code being changed on the initial commit and then only 100 on each following commit (at least that happened to me).

So is one of these solutions right or is there another one that I am missing?

PS: The same also applies to Makefiles and similar files.

  • I don't understand what you're asking. Maybe if you provided a more specific example of the problem you're trying to solve. – Robert Harvey Jan 15 '17 at 16:46
  • If I am using external libraries, in this case SFML, should I upload the whole SFML folder to my GitHub or should it be in gitignore, so that it doesn't show up, since it isn't my code and technically doesn't have much to do with my project (especially since there is a GitHub repository that contains exactly those files) – Post Self Jan 15 '17 at 16:48
  • Don't they have package managers for this sort of thing? – Robert Harvey Jan 15 '17 at 16:48
  • 3
    And if you don't use package managers but want source files included you might want to use git submodules. – stijn Jan 15 '17 at 16:54
  • 1
    P.P.S. This doesn't apply to makefiles. You definitely should include your makefile in your repository so people can clone the project and immediately be able to build it. – RubberDuck Jan 15 '17 at 17:50
5

As a rule, you should list somewhere the OS, compiler version, tools that I need to run your code, and then I should be able to clone your repository, follow your build instructions, and be able to run the code.

Can I do that without your makefile? If yes, leave the makefile out. If no, add the makefile. Having your documentation would be nice, too. Oh, build instructions that work would be nice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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