According to IM Jeremy Silman the best way is by really understanding the moves.
How to commit ideas/lines to memory?

Yep, it's really the only way. If you memorize, all your opponent has to do is play something not in the book and you're screwed.
Basically the only way to think like a GM is to be a GM. But hopefully at least a little of it will rub off on the rest of us, if we listen long and hard enough...

For me the first time I read a book I absorb maybe 70% of the main line, and that's it. Then I go, play a few games with it, and look up lines to correct my mistakes. As you get more experience in a position the tactical ideas and move order nuances become much easier to remember. Then go back and re-read the book (or watch the videos) and absorb more.
Good answer...
It really depends on what your goal is and just how much you want or need to memorize. If you're training for a tournament the next day or something urgent like that, you can try to cram it all in by mass repetition. The problem is, you won't understand the moves and should your opponent deviate (even with an obviously inferior move), you probably won't know what to do. I would say that the best way to memorize lines is simply to play them as often as you can. On chess.com, you have the luxury of using an opening database when you don't know how to play a certain line of your favorite opening. You're probably unlikely to account for every little nuance, but by gaining experience in the opening firsthand, you'll probably get to the point where you can be satisfied with what you get out of the opening.
And it's chess. So might as well have fun while you're at it. :)

Go play it in a serious OTB game. Realize you've forgotten all the lines, then spend half an hour during the game doing your utmost to find the best moves. After the game, look up what you should have done and why.
Result: you'll understand it way better, remember it better, and maybe the line you found yourself is also existing theory and just as good, and then it's more likely to fit your style than a line someone else invented.

I could show you about a gross lines, and only be able to explane twenty of them with things other than generic comments
example of a line I know fairly well
1. e4 Nf6
Black allows white to establish a strong classical style pawn structure in the center which Black will attempt to destroy in the middle game, where as white will attempt to use the structure before Black destroys it. Not very drawish, and very agressive for Black
one I dont know very well
1. d4 d5
Closed position, very limited in tactics, both sides attempt to squeeze the other to death
I was recently watching GM Shankland's series on the najdorf, and I watched all of the videos, then I realized there was no way I was going to remember all the nuances and little details of the opening. How do I try to commit these to memory? Do I take notes on the videos? Or some other method- like watching the videos repeatedly?