Git 進階
Amanda Crawford-Adamo
Software and Data Engineer
Git filter-repo 指令
git filter-repo
可快速且安全重寫 Git 儲存庫歷史的工具。
用途
用 pip 安裝 git filter-repo
pip install git-filter-repo
從每一次提交中移除 secrets.txt
git filter-repo --path secrets.txt --invert-paths
Filter-Repo 相關參數
--path:指定要操作的路徑
--invert-paths:對除 --path 指定外的所有路徑進行操作
輸出
Parsed 150 commits
New history written in 0.10 seconds; now repacking/cleaning...
Repacking your repo and cleaning out old unneeded objects
關鍵影響
使用情境
小訣竅
Git 進階