Is it possible to force clangd to reindex when for example the compile_commands.json has changed? What happens when I change Git branch? I can easily generate a new compile_commands.json for the new branch but do clangd pick this up?
No clangd (currently) only invalidates cached index shards if file contents has changed.
If you want to force re-indexing from scratch you should delete shards that are located next to compile_commands.json, either in
.clangd/index/* (before clangd-11) or