Remove large commits from git

前端 未结 5 1414
再見小時候
再見小時候 2021-02-14 05:37

We\'re running a central git repository (gforge) that everyone pulls from and pushes to. Unfortunately, some inept co-workers have decided that pushing several 10-100Mb jar file

5条回答
  •  长发绾君心
    2021-02-14 05:42

    Use filter-branch!

    git filter-branch --tree-filter 'find . -name "*.jar" -exec rm {} \;'
    

    Then just purge all the commits that don't have any files in them with:

    git filter-branch -f --prune-empty -- --all
    

提交回复
热议问题