The canonical guide to removing the commit is here. It in essence gives two routes, git-filter-branch
, and bfg
.
However, if you really mean completely remove, you are missing step 9 in that process, i.e. :
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
which will actually delete the unused references.
Note also that if these are either sensitive data that should never have been committed, or they are just huge (so you don't want a git pull
to pull them down again), you need to ensure they are removed from:
- The upstream repo (and any other upstream repos)
- All your collaborator's repos (so they don't push them back) - it's normally easier to ask them to delete their repo and reclone.
Note also the comment in there about getting collaborators to rebase rather than merge.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…