It gets a little convoluted. In 1799 Congress created the rank "General of the Armies" which was naturally awarded to George Washington. It is reported that Washington did not wear a military uniform after he retired as President. IN 1866 Congress authorized the title "General of the Army" which was naturally awarded to Grant. He wore a 4 star insignia prior to his presidential election. After Grant became U.S. president, he was succeeded as General of the Army by
William T. Sherman, effective 4 March 1869. In 1872, Sherman ordered the insignia changed to two stars, with the
coat of arms of the United States in between. For a few months in 1885, as he was dying, Grant was accorded a special honor and his rank was restored by Congressional legislation. By an Act of Congress on 1 June 1888, the grade was conferred upon
Philip Sheridan, who by then was in failing health. The rank of General of the Army ceased to exist with Sheridan's death on 5 August 1888. In 1919 Congress again authorized the title "General of the Armies." Pershing was appointed September 3, 1919. He continued to wear a 4 star insignia. When Congress authorized the 5 star ranks General of the Army and Fleet Admiral the law did not specifically deal with Pershing who in retirement continued to wear 4 stars. Secretary of War Stinson tried to address this issue "It appears the intent of the Army was to make the General of the Armies senior in grade to the General of the Army. I have advised Congress that the War Department concurs in such proposed action." This lead to the design 6 star insignia although I do not believe Pershing ever wore it. Finally in January 1976 Congress got involved again passing a law declaring Washington "General of the Armies" with "rank and precedence over all other grades of the Army, past or present".