Make Git rebuild history using the current .gitignore
问题 I did not use .gitignore to ignore files such as compiled binaries in my project, so these compiled binaries have been committed into the Git repository. And now I add .gitignore to my project. I want to rebuild the whole Git repo ignoring the files listed in .gitignore without losing any history. How can I do that? 回答1: Remove those binary from the current cache if they were just added. git rm --cached abinary Then your .gitignore will automatically ignores those binaries. But if they were