誤 Push 之檔案的處理方式
結論
到 PowerShell 下 Git 指令移除已 Push 的東西
- 移除某資料夾
 
git rm -r --cached .\ServiceDependencies\- 移除某檔案
 
git rm --cached profile.arm.json然後把要排除的東西加到忽略檔 .gitgnore
- 忽略資料夾
 
src/MyProject.HttpApi.Host/Properties/ServiceDependencies/*
src/MyProject.IdentityServer/Properties/ServiceDependencies/*- 忽略檔案
 
profile.arm.json或是反過來先加忽略,再全部移除,然後重新追蹤,最後重新 Commit
echo "profile.arm.json" > .gitgnoregit rm -r --cached .git add .git commit -m 'update .gitignore'
參照
更新成符合 .gitignore 設定的追蹤狀態 (poychang.net)
