You can't delete the block data themselves, but you can reset the blockchain state to a specific block by using the invalidateblock command. This command will mark a specific block and its descendants as invalid thus setting the chainstate to the block immediately before it. Note that this may not necessarily work to switch to a blockchain fork and may still not be able to use the forked blockchain.
If you want to go back to the 500,000th block, you would invalidate the 500,001st block with the call invalidateblock 0000000000000000005c9959b3216f8640f94ec96edea69fe12ad7dee8b74e92. By invalidating the 500,001st block the chainstate resets to height 500,000.
How do I make it go back to block 500000 with that commands? "invalidateblock 500000" ? – masterq – 2018-01-15T21:14:56.323
4You would do
invalidateblock 0000000000000000005c9959b3216f8640f94ec96edea69fe12ad7dee8b74e92. That will invalidate the 500001st block thus setting the chainstate to the block at height 500000. – Andrew Chow – 2018-01-15T21:29:04.497