Banana Banana - 13 days ago 5
Git Question

Should I commit dlls and generated bin files to repository on GitHub or just ignore them?

I am using a private repository on GitHub to develop a project. The problem is that every time I do a commit, a bunch of bin files that I haven't manually modified get committed too. If I ignore them, will that cause any problems when someone else pull or clone the repo? Also if you can give me any best practices tips would be great.

enter image description here

On this commit for example I've only modified around 8 files, but 44 changes are being pushed to the repo. Most of them bin files.

Answer

If those files were never committed before, but are part of your index, you need to reset them (to remove them from the index)

git reset *.dll
git reset *.mdb
git reset *.apk

(If there were committed before, see "Ignoring files")

Then you can add them to .gitignore

*.dll
*.mdb
*.apk

Check with git status that those files are not listed anymore.

Finally, you can git add -A, and git commit

Ignoring generated files won't be an issue for other users: they will rebuild them from the sources of the repo.

Regarding dlls, it is best to include only a NuSpec or a nuget.config which will declare what you need to fetch said dll from Nuget.
See also "The right way to restore NuGet packages" from David Ebbo, and Nuget automatic restore.