New Mexico flag?
The IMDB goofs section on Major Dundee says:
The film takes place during the American Civil War, which ended in 1865, and the New Mexico state flag is shown in the garrison office. However, New Mexico didn't become a state until 1912 and the flag wasn't designed until after that--about 1920.
Here is a link to images of the New Mexico state flag:
Actually there are two flags hanging from standing lances in Major Dundee's office. One looks like a United States national flag and one has a yellow field like the New Mexico flag. But the images on the yellow flag are partially seen in various shots and instead of the New Mexico emblem are parts of the US coat of arms with the eagle.
The two flags in Dundee's office are what is called a stand of colors or standards. Each regiment or battalion level organization in the US army had a stand of two colors, a national color based on the United States national flag and a regimental color with the coat of arms of the United States. In the 19th century cavalry colors were called standards.
Many cavalry and Indians movies show a stand of colors in the commanding officer's office, since at least as early as Fort Apache in 1948, despite the fact that there were several times as many forts in the west as there were regiments in the army.
Here you can see images of US cavalry flags including regimental standards with eagles:
The yellow flag in Dundee's office is obviously a yellow regimental standard handing in folds from a vertical lance. No doubt it resembles the regimental standard described in Regulations for the Army of the United States 1895, Article XXX, section 218. on page 31.
Unfortunately the standards in the 1895 regulations were new at the time. In Major Dundee's time the cavalry did not have national standards and their regimental standards had a blue field as described in Revised United States Army Regulations 1861, 1863, Article L, Section 1468 on page 462.
Thus the flag in Dundee's office is not anachronistic because it is a new Mexico flag, it is anachronistic because it is a yellow cavalry standard that was not used until 30 years later.