Git: Exclude a file with git clean

前端 未结 5 1045
灰色年华
灰色年华 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:05

    If you have commited the pyc's and so on already, do the following:

    Add *.pyc, *~ and local_settings.py to the .gitignore. Then do in your git repository:

    find . -name '*.pyc' | xargs rm
    find . -name '*~' | xargs rm
    

    then do:

    git commit -am "get rif of them"
    

    now they shouldn't bother you anymore

提交回复
热议问题