Using .gitignore to ignore Stan models with git

Sorry if I missed an existing post.
I didn’t see anything when I searched for ‘gitignore stan’ - The Stan Forums (mc-stan.org).

I’m using git to track my project. Let’s say I have my_model.stan.
This generates a file, my_model.
How do I “ignore” these files with git?

Any tips for blocking git from tracking this file via .gitinore? For example, I block csv files with *.csv, but the complied stan models do not have an ending.

1 Like

It is a bit tricky, but I have used something like this before:

# ignore *everything*
*
!/**/
# and then this 'unignores' anything with an extension
!*.*
# now, the rest of your gitignore should appear after the above
# on windows Stan executables end in .exe
*.exe
# Ignore temporary files created as part of compilation.
*.hpp
*.o
6 Likes

Thank you!

That’s the type of hack I was looking for.

1 Like