I have an existing repository in Azure DevOps that is currently tracking various /obj, /bin files (.dll, .pdb, .cache, etc.). I don't want to track these anymore; however I am worried that if I delete these files from my repository, then the project will break when I try to release it using a pipeline. Are these safe to exclude and delete, or do I need to manually include them somewhere? I don't have a good understanding of how these files are generated or what they're used for. Thanks.
1 Answer
Do not store your generated binaries in git. Git stores every version of a binary as a full new version, not just the changes. Your projects must be setup in the way that the binaries can be rebuilt anywhere.
Then in the pipeline your code is copied to a second directory structure and the projects will build and generate the binaries for you. From there unit tests are done and whatever more is in the pipeline.
Use
git rm
to remove them from the repo
(optional)
git filter-branch
to remove them from old commits
git gc --prune=now
to garbage collect them from the ..git directory