Remove .pyc files from Git remote repository

前端 未结 10 687
广开言路
广开言路 2021-01-30 10:37

Accidentally, I have pushed the .pyc files to the master repository. Now I want to delete them but I can´t do it. Is there any way to remove them directly from the Bitbucket sit

10条回答
  •  伪装坚强ぢ
    2021-01-30 11:03

    I used simeg's solution but also wanted to deleted tons of *.pyc files added by mistake to a branch. I used awk to delete them from cache recursively.

    git status | awk '{if($1=="modified:" && $2!=".gitignore") ; system("git rm --cached "$2)}'
    

    Then, I deleted the files from my local

    find . -name *.pyc -delete
    

提交回复
热议问题