I put all dead code in a file called "deadcode.c" and get done with it. If I need it again, I can always copy from there. Easier than searching through git history.
Use version control, develop new features in branches, merge to master + tag. There.
Presumably, the compiler never sees deadcode.c. Or did I misunderstand the question?