From The Art of Manliness:
You might think that sewing isn’t a manly skill, and rely on your mom or wife to replace buttons for you when they’ve popped off a shirt or pair of pants. Yet men of yore often knew darn well knew how to patch a hole, mend a jacket, and yes, replace a button; if they lost one while marching to battle, sailing the seas, or simply traveling the world, they couldn’t rely on someone else to do it! It’s a skill that contributes to self-sufficiency.
Picking up a few basic sewing skills can prove exceptionally helpful even in modern times, especially in tight situations like losing the button on a dress shirt before an important meeting. To be extra prepared, consider carrying an emergency sewing kit with you in your travel bag, along with extra buttons in a few basic styles and colors. And don’t forget that most of your dress shirts, jackets, and pants have spare buttons sewn into the fabric near the pockets or edges of the fabric, so when the time comes to break out your new skill, they’ll be ready and waiting for your needle and thread.
In the guide above, we feature the parallel pattern for stitching a 4-hole button. You could also go with a square, an X, or even an arrow. With a 2-hole button, your options are obviously limited to just one pattern.