Work Up the Nerve

What does the idiom “work up the nerve” mean?

Definition: find the courage, marshal one’s bravery

Example: I finally worked up the nerve to ask Sheila out, and she told me she was in a relationship with someone else.