[Suggestion] Add compile_commands.* to cpython/.gitignore

Hi, I am not sure where to discuss this, hence I posted under Python Help.

I am wondering if it will affect any existing workflow to add compile_commands.json (and ideally compile_commands.txt) to cpython/.gitignore.

If nothing will be affected, I would suggest adding such entries to make it more convenient for clangd users.

My workflow looks like this (with vscode-clangd plugin):

make --dry-run | grep -E '^(g?)cc' > compile_commands.txt
compiledb --parse compile_commands.txt

Alternative solution is to save compiledb under build/, but this in turn requires ignoring .vscode which stores project specific configuration for the plugin.

Well the alternative actually works for me - .vscode is already ignored.

You can add your own core.excludesfile setting to your global .gitconfig file. For example, I have a ~/.gitignore file containing *.orig, and core.excludesfile = ~/.gitignore in ~/.gitconfig. Season paths to taste :slight_smile:

1 Like

Thanks! Learnt a new trick.

You can also add them to .git/info/exclude, that’s per-repo.

1 Like