Git: Exclude a file with git clean

前端 未结 5 1050
灰色年华
灰色年华 2020-12-14 14:45

i\'m working on a big python project, and i\'m really sick if .pyc and *~ files. I\'d like to remove them. I\'ve seen that the -X flag of git clean would remove

5条回答
  •  一向
    一向 (楼主)
    2020-12-14 15:12

    If you're running Python 2.6+ just set the environment variable, PYTHONDONTWRITEBYTECODE, to true. You can just add the following to something like .profile or .bashrc to disable it entirely for your profile:

    export PYTHONDONTWRITEBYTECODE=true
    

    Or, if you just want to do that for a particular project you're working, you'll need to run the above in your shell each time (or in one of your virtualenv init scripts if you're using virtualenv and virtualenvwrapper), or you can simply pass the -B parameter when you call python, e.g.

    python -B manage.py runserver
    

提交回复
热议问题