Transcribe
Short answer: Work out a song or solo by listening, then play or write it down.
Practise it in a lesson
Fretwork lessons use transcribe in context, with step-by-step practice and a “Stuck?” panel for common problems. The first stages are free.