0

While working on a project I accidentally committed one of the videos I was testing, pushed it to remote, and made quite a few other commits and pushes before I realized that video was in there. I know its not super ideal to try to rewrite the history, but because of this the git repo is like 200 MB which is getting me yelled at at work.

I tried to do a git rebase -i HEAD~31 31 is my oldest commit, and I found all the commits I want to delete. I tried to drop them, which didn't seem to work, I tried to delete them and then do git push origin HEAD --force but that just said that the branch was up to date. The pushes with the video are still in the remote, what can I do to remove them?

  • 1
    The commit does not *contain* the large file; it *introduced* the large file. The file is part of the state of all future commits, so simply removing the first one does not remove the file itself from the repository. You cannot remove the file without rewriting history. – chepner Jun 21 '23 at 16:12

1 Answers1

-1

The easiest and quickest way would be to remove the file using the web UI for gitlab or github or use git rm. You can squash the commit to remove it.