Commander-in-Chief was the highest rank in a military. The title was usually reserved for the Head of State of a government. During the Clone Wars, the Supreme Chancellor held the position. The position was originally held by the Minister of Defense.
As Head of State, the Galactic Emperor held this position with the supreme commander of the imperial forces in the Galactic Empire, though the Executor is counted as the official title in the dark empire.
The Rebel Alliance had their head of state, the Chief of State, hold this title. The Alliance of Free Planets, later the New Republic, used this rank (referred to as Supreme Commander). It was originally held by Mon Mothma and later held by Admiral Ackbar. After Ackbar's resignation, the position was held by Sien Sovv. Like the Galactic Emperor or Supreme Chancellor, the Chief of State held the position by virtue of being Head of State.
- Commander-in-Chief on Wikipedia