I found out that there was some secret info committed early in my git repository. Although it could've been found a long time ago, I still wanted to remove it, so I made a new clone and then ran
git-filter-repo --path file1.txt --path file2.txt --invert-paths --replace-text replacements.txt --force
After making a backup of the remote repository, I force pushed by doing
git remote add origin https://github.com/...
git push origin --force --all
Finally, I ran git fetch in my original local repository (that has changes) which succeeds.
My issue is with the output of git rev-list --count --all before and after fetching:
- Before filtering, it's 1478.
- After filtering, it's 1475.
- After fetching the force pushed repository, it's 2531.
Why were the number of commits almost doubled after fetching? I'm worried that the old commits may be still in the repository. If they are, how can I get rid of them?
git stash followed by git rebase -i origin/main (where I droped the 4 commits that were listed) lowered it to 2493, but I'm still not sure why it's still so much higher. git gc --aggressive --prune=now didn't changed the count.