I have a question about git:
I forgot to add .gitignore before committing, and committed some binary files in the format of .db
or .pyc
. And to make matters worse, I committed several versions without paying attention. Now how do I commit it? Are these binaries being removed in batches from all versions and will they be stopped from being tracked in the future? Thank you!
To rewrite past commits, you can use
git filter-branch
or thisUse git rm file to delete the tracking of the file, and it will be deleted locally.
Use git rm file --cached file to delete the tracking of the file, but it will be retained locally.
Remember to add modification .gitignore and then push it
Please ensure safety before starting the command: