Git - Remove All of a Certain Type of File from the Repository

前端 未结 5 1428
情歌与酒
情歌与酒 2020-12-31 05:54

How do I remove all of a certain type of file from the Repository? I\'m using

git filter-branch --index-filter \'git rm -rf --cached **/*.jar\'
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-31 06:22

    The easiest way I've found is to use the BFG Repo-Cleaner

    The instructions on the project page are clear. The command you would use is something like:

    bfg --delete-files "*.jar"  my-repo.git
    

    BFG will clean the history of the repo of all files ending in the .jar extension. You can then inspect the result before pushing it back to the server.

提交回复
热议问题