What are the advantages / disadvantages OR the standard practice of including packages in your github repo?
It has disadvantages similar to including produced code like the binaries the project itself produces; anyone updating the packages will now have a bunch of commits to do, which will potentially conflict with those done by someone else who updated the packages, and it can get very messy for zero gain.
I normally have the following in my .gitignore for .NET projects:
packages/**/*
!packages/repositories.config
That is, it ignores all of the contents of any folder called "packages" except for the repositories.config, which gets included in the repo, so any cloned repository has all it needs to restore the needed packages from nuget.
I think that the best practice is to omit nuget packages. There is central source where you always can get package of given version (nuget itself), so there is not much sense to bloat your git repostory with them. Every developer can use Automatic Package Restore feature (see https://docs.nuget.org/consume/package-restore), to automatically download any missing nuget packages on build. Article above from nuget docs also shows you how to correctly setup things for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With