Did you know that after the fall of the Tokugawa Shogunate in 1868, those opposed to the Imperial Restoration retreated to the North and formed the Republic of Ezo? Where is Ezo? Ezo is Hokkaido. At least that was what Hokkaido was called at that time.
As the Imperial Armies continued to move East and then North, the opposition forces retreated. Several Northern Han's or Domain's formed a union including Aizu, Sendai and several others. Along with the remnants of the Shinsengumi, they fought a series of battles against the Imperial Army into 1869.
Most of the northern Han's fell after the battle of Aizu and they declared their allegiance to the Emperor. The remaining opposition forces retreated to Ezo (Hokkaido) where they defeated a small contingent of Imperial soldiers at the Matsumae Han castle.
In December 1868, the opposition forces declared independence and created the Republic of Ezo. They elected a President and a Vice President. However, by January 1869, the Imperial Army massed over 16,000 troops for a final confrontation with the opposition forces. several thousand Imperial soldiers crossed the strait to Hakodate and the last of the opposition forces and Shinsengumi Samurai surrendered on May 18, 1869.