“CRAP! I Commit Pushed a database file!”
Or some other important credential file that shouldn’t be in the source control. What do I do?
Well, thanks to this stackoverflow post, we can do the following:
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch SOME.DB' \
--prune-empty --tag-name-filter cat -- --all
Replace the SOME.DB with your desired file, and make sure you have correct relative path.
But what’s next? How can I commit/push? Here’s the comment for that:
git push --all --force
And then it fails due to authentication.
Well, to generate cred, go here:
There, it has Username and Password there for you to use. Problem solved!