On Fri, 20 Aug 2021 at 15:50, Stephen J. Turnbull <turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
Jack DeVries writes:

 > What does everyone think? Can we add these two items to the .gitignore:
 > - `.cache`
 > - `compile_commands.json`

I don't see any cost to this -- .cache is uncomfortably generic, but
given the semantics of "cache" gitignoring it seems a good idea.

ISTM rather than have every project add these to the project-specific
gitignore this is really something every clang user should have in
their personal gitignore for best effect.  As long as they don't
though, having the project do it will avoid inadvertantly git-adding
these objects.

The important thing there is "inadvertantly". .gitignore is only for untracked files - if something in an ignored directory needs to be in the repo then it can be added.

Whilst I'd say it's a really good idea to have your build system artifacts in your personal gitignore, IMO any files and directories generated by any supported build systems should be in the repo's .gitignore so those less experienced with git don't mess up.

Tim Delaney