This Minuet by Bach is in binary form. The repetition bars helps us find out the end of each section.
Section B is longer than section A and the first 8 measures of section A are repeated at the end. This is known as rounded binary form. Section B starts in E minor before returning to G major in measure 25: