Automatically remove *.pyc files and otherwise-empty directories when I check out a new branch

后端 未结 4 1422
没有蜡笔的小新
没有蜡笔的小新 2020-12-12 16:31

So here\'s an interesting situation when using git and python, and I\'m sure it happens for other situations as well.

Let\'s say I make a git repo with a folder /foo

4条回答
  •  [愿得一人]
    2020-12-12 16:54

    Another option is to not solve this as a git problem at all, but as a Python problem. You can use the PYTHONDONTWRITEBYTECODE environment variable to prevent Python from writing .pyc files in the first place. Then you won't have anything to clean up when you switch branches.

提交回复
热议问题