Esteban Verbel
Esteban Verbel

Reputation: 738

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.

Upvotes: 1

Views: 6272

Answers (2)

Marina Liu
Marina Liu

Reputation: 38116

If the dll files and bin files are the output of your build project, it’s unnecessary to commit them, you can ignore them by .gitignore file and it has no effect for anyone who use the repo.

If the dll files are 3rd-party files which used to support some functions of your project, you’d better put them in version control list.

Upvotes: 4

VonC
VonC

Reputation: 1326576

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.

Upvotes: 2

Related Questions