I am using the gitlab repository for uploading my code files. I have made more than 500 commits. My repo size was upto 540 mb. I want to minimize the size of the repo by deleting unwanted files in the repo.

Somehow i managed and deleted the files in my local. Now my current file size is 10 mb in the local. I pushed it and it was good. Eventhough it shows 540mb. I came to know the previous commit files holds the storage. There is a zip file with a size of 400 mb which is in one of my older commit.

I found the commit by using the shell script. I want to delete the zip file in the commit. But it shows `"You can only delete files when you are on the branch"` in the gitlab webui. In the terminal, I found the command `git rm <file_name>` to remove the file. I got the file path from the commit. But I don't know how to use it on a particular commit. It holds some important files. I don't wanna play with it.

My question is: how do I remove a certain file in a particular commit in gitlab without affecting any other commits? I tried Stack Overflow and found some answers to delete the file in previous commit but not in the older commit. Help me with some solutions.