I have a repository with source code (mostly *.php
, *.js
) and documentation files (mostly *.md
, *.html
, *.svg
) that are automatically generated from annotations. All documentation resides in a seperate sub-directory (./doc
) within the repository.
On the one hand side, I want the documentation to be tracked via git
and I want it to be committed/pushed to the server if it changes, because the it is vary comfortable to have a browsable and up-to-date documentation which is nicely displayed by github.
On the other hand side, it is very annoying to see the auto-generated files during an output of the git diff
command. For example, if one line of source code is changed between two commits, then the git diff
does not only output this single line but all auto-generated documentation, too, because the whole auto-generated documentation has changed.
Is there any way how to tell git to track the documentation but exclude it from diff
by default? I would also be OK for me if git would consider all documentation files as blobs. Then at least diff
would only claim that the files have changed, but not display all the documentation line-per-line.