You try to ignore the idea. It dances around the edges of your consciousness. You stick your head down and go back to work on your dull, boring, current bit of writing. The new idea shimmers and sparkles, plot developments stretch out before you. You realise that your new idea is so much better than what you're working on and then you start to play around with the new idea....
Stop! Don't be seduced by new ideas. Of course it looks shiny and wonderful and exciting - it's new. You haven't got to know it. Once, the idea you're currently working on was equally exciting. Puppies and kittens are cute, but they grow up. They don't stay at that gorgeous stage forever. When they grow up, they become less immediately appealing, and the drawbacks to pet ownership become more obvious.
Every writer knows what it's like to get a new idea. It usually means you've got a bit stuck on the old idea. I find the best thing to do is write the new idea down with enough detail so I'll know what was so appealing about it, and then close the folder. The idea is safe, waiting for when you're ready for it. Because you're not ready now - you have other work to finish. And then you need to transfer the energy to the old idea and get at least a rough draft finished.
All new ideas are as cute as puppies and kittens and, unlike puppies and kittens, you can abandon them when the cuteness fades and the need to walk and feed every day starts to pall. But what you'll end up with is masses of unfinished work, and unfinished work is of no use to a writer.