If it is part of your project, I would make a branch or a tag and then delete that code from your main repo.
I used to keep blocks of code in my main repo that served no other purpose other than that they might be needed later. Really what I was saying was that it might be useful later and I needed to find it. A tag might be even better as branches are supposed to be more ephemeral. Branch vs TagBranch vs Tag
In any case unused code will just confuse you and other devs later. So it's not a great practice to leave it in a project.