2011年9月8日星期四

How do I remove sensitive files from git's history

Remove sensitive data / GitHub

----

git filter-branch --index-filter 'git rm --cached --ignore-unmatch Rakefile' HEAD
git push origin master --force

=====

git filter-branch --index-filter 'git update-index --remove filename' HEAD
git push --force --verbose --dry-run
git push --force

*option: Cleanup and reclaiming space *

rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now

*Note that pushing the branch to a new or empty GitHub repo and then making a fresh clone from GitHub will have the same effect.*


git commit -a --amend

*amend last commit*

没有评论:

发表评论