Bar tacks are simply a narrow and dense zigzag stitch. Take a look at any of your store-bought pants and you’ll see them at the tops of back pockets, holding belt loops in place, along the curved stitching on fly zip fronts, etc. Their purpose is to reinforce areas of high stress on garments–the areas that will get pulled on often. Think about how often your hands/phone/keys/wallet/etc. are in and out of your pockets; bar tacks reinforce both the fabric and the stitching. When you see bar tacks on fly zips, their purpose is to secure the fly shield and to take the stress off of the zipper when you take your pants off and on. Without bar tacks, your zipper would likely break.
To sew a bar tack, start with a standard zigzag stitch between 2mm-3mm wide and 0.3-0.5mm long. At the beginning of each project, test a few different widths and lengths to decide what works and looks best with your fabric + thread combo, then write it down to save for later. I use different settings for each project, as the different fabric thicknesses and thread types make a big difference each time. The standard length for bar tacks is 1/2″, but you may also want to practice different lengths to decide what you like and what makes sense for each individual location.
If you don’t want to sew bar tacks or if you have a straight-stitch-only machine, you may also stitch and backstitch several times in their place.
When it comes to sewing bar tacks on bulky areas (like belt loops), place a hump jumper (see photo above–this occasionally comes with machines, but may also be purchased separately) or a piece of folded cardboard under the back side of your presser foot; this will help to level the presser foot and will make crossing over bulky areas a breeze (you can use it on any bulky areas, like crossing over a side seam on jeans).