This question already has an answer here:

I want to simulate orphaned block locally, it's possible to do this?

marked as duplicate by Richard Horrocks, Ismael, eth Jul 14 '17 at 19:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.