3 回答
![?](http://img1.sycdn.imooc.com/5458643d0001a93c02200220-100-100.jpg)
TA贡献1878条经验 获得超4个赞
Windows用户注意事项
git filter-branch --index-filter \ 'git update-index --remove filename' <introduction-revision-sha1>..HEAD git push --force --verbose --dry-run git push --force
git commit -a --amend
git rm
git rebase -i origin/master
$EDITOR file-to-fix git commit -a --amend git rebase --continue
![?](http://img1.sycdn.imooc.com/545862e700016daa02200220-100-100.jpg)
TA贡献1712条经验 获得超3个赞
rm -rf .git/refs/original/git reflog expire --all git gc --aggressive --prune
#!/bin/bashset -o errexit# Author: David Underhill# Script to permanently delete files/folders from your git repository. To use # it, cd to your repository's root and then run the script with a list of paths# you want to delete, e.g., git-delete-history path1 path2if [ $# -eq 0 ]; then exit 0fi# make sure we're at the root of git repoif [ ! -d .git ]; then echo "Error: must run this script from the root of a git repository" exit 1fi# remove all paths passed as arguments from the history of the repofiles=$@ git filter-branch --index-filter \"git rm -rf --cached --ignore-unmatch $files" HEAD# remove the temporary history git-filter-branch# otherwise leaves behind for a long timerm -rf .git/refs/original/ && \ git reflog expire --all && \ git gc --aggressive --prune
git reflog expire --expire=now --all && \ git gc --aggressive --prune=now
- 3 回答
- 0 关注
- 1048 浏览
添加回答
举报