git-filter-repo
that rewrites the history (like this answer suggests)git-filter-repo --analyze
has confirmed that the files are, in fact, removedgit push --force
to fore-push the rewritten history to the originSo far so good
However
When the repo is pulled to other devs' machines (using git pull --rebase
) the git-filter-repo --analyze
still shows those big deleted blobs/files (not shown on my machine though)
git gc
and git prune
do not help.
What have I done wrong?
If a remote branch has changed and you want to match it exactly:
$ git fetch
$ git reset —-hard origin/main
If there are local commits they wish to keep that’s also possible using git rebase onto - for example to keep commits on feature-branch
:
$ git fetch
$ git rebase --onto origin/main main feature-branch
In the circumstances described in the question your colleagues have the unwanted files in their local clones - merging/rebasing the remote branch will not change that there are commits containing these unwanted files ( and any subsequent push will reintroduce those unwanted files to the remote).