git mistakenly commits a file that you do not want to commit, and the method you want to remove from the repository
Example: Remove Lunch_history from the repository
Git filter-branch–tree-filter "rm-f lunch_history" HEAD
Will output the following information:
Rewrite 48A23742F0B5C35127DAA40A1303C2AF7976BAAC (29/29)
Ref ' refs/heads/new_bianjb_7300 ' was rewritten
This means: The new repository has been rewritten with a 40-bit hash value. You also need to remove the backup from the rewrite process:
git update-ref-d refs/original/refs/heads/new_bianjb_7300 48A23742F0B5C35127DAA40A1303C2AF7976BAAC
Otherwise, the next action will also cause an error:
Cannot create a new backup.
A previous backup already exists in refs/original/
Force overwriting the backup with-f
At this point, do the following:
Delete the. Git/refs/original Directory
This directory is a temporary file that you can delete
Reference: http://www.cnblogs.com/RichardLee/articles/2938382.html
Reference: http://www.davidverhasselt.com/git-how-to-remove-your-password-from-a-repository/