假設要刪除var/log/system.log
,我使用下面的命令解決了。
git filter-branch --index-filter 'git rm --cached --ignore-unmatch var/log/system.log' --tag-name-filter cat -- --all
Stackoverflow帖子上提到了幾種策略,有重新修改,然後合併commit;也有使用另外的工具,不過上面的方案是我覺得最好的。
假設要刪除var/log/system.log
,我使用下面的命令解決了。
git filter-branch --index-filter 'git rm --cached --ignore-unmatch var/log/system.log' --tag-name-filter cat -- --all
Stackoverflow帖子上提到了幾種策略,有重新修改,然後合併commit;也有使用另外的工具,不過上面的方案是我覺得最好的。