I wrote about how you can use git exclude to keep personal files out of a project without committing them.

Note: You may first want to read my article Git exclude, a handy feature you might not know about.

In Django, I sometimes want to run queries or perform specific actions quickly without going through a UI or a process.

In these situations, I will opt for a Django management command: I can program it however I want, then call it from the command-line interface as often as I want.

However, I do not want my experimental code to end up in a repository. So this is where git exclude comes into play.

What I do:

  1. Create a management command in any app of my choosing.
  2. I usually name it zzz_marijke.py.
  3. Git exclude the file.
  4. Profit!