
The Brazilian flag has gone through many iterations. Since Brazil was an empire (1822 – 1889), the flag has consisted of a green field, with a yellow diamond in the middle (only this previous version had a coat of arms in the center). By 1889, when Brazil became a republic, the flag changed along with it, but this time by adding a blue circle on a starry sky with a curved band over it (containing the national motto).
The first republican flag was heavily inspired by the US flag but it was short-lived since another, better design was proposed. Eventually though, the states of Goiás, Piauí and Sergipe adopted versions of the US-inspired Brazilian flag and they still fly them today. Even São Paulo’s actual flag was also nixed as a possible national flag.
Colors
It’s written everywhere that the colors green, blue and yellow represent the forests, sky and gold (the white is supposed to be peace). While this could be perfectly true, I adhere to an alternate explanation, that the main colors of green and yellow are representative of the joining of the Braganza (Dom Pedro I) and Hapsburg (Dona Leopoldina) Houses.
Stars
Since the current flag was chosen, it’s had the smallest of alterations concerning the adding of stars which, while being parts of actual constellations, also represent the 26 federal states and 1 federal district. Apparently, the formation was based on the sky over Rio de Janeiro at the moment of proclamation, and they are placed as if Rio is being observed from far out in space.

Motto
The motto, or lema in Portuguese, of Ordem e Progresso (Order and Progress) came from positivist French philosopher Auguste Comte, of whom the overthrowers of the monarchy were fans. Comte’s whole motto was “Love as a principle and order as the basis; Progress as the goal” (I’m imagining the flag today with “Amor e Progresso”. Hey, why not?).