Refit

Refit and retrofit are the processes by which a starship (or any other type of vessel) is overhauled and re-outfitted with newer technology.

Refits
A refit was the installation of updated equipment aboard a starship. It differed with a retrofit in that the vessel's overall structure was changed during the process. A refit required some form of spacedock. 

During the mid-22nd century the Romulans modified one of their Warbirds into a drone-ship. 

The original USS Enterprise (NCC-1701) underwent a major refit beginning in 2270 which essentially turned it into a new vessel. The refit, which required 18 months in Spacedock, involved changing or reconstructing a majority of the ship's systems, including the weapon's systems and warp drive. 

Following the Enterprise's battle with the USS Reliant, Montgomery Scott informed Admiral Kirk that the refit time required until the ship could be taken out again would be eight weeks, but that he could do it in two. Kirk then noted Scotty's propensity to multiply his repair estimates by a factor of four, to which Scotty replied, "How else can I keep my reputation as a miracle worker?"

The USS Lakota was refitted in 2372, just before Erika Benteen took command. The refit included upgrades to weapons beyond the norm for an ship, including quantum torpedoes. 

Retrofits
A retrofit was the installation of updated equipment aboard a starship. It differs from a refit in that the vessel's overall structure remained unchanged in the process – the components in question were simply swapped out. A retrofit did not always require a spacedock.

A standard part of retrofits was to switch out the bridge module of a starship design. Bridge modules might appear radically different from previous versions, while the structure of the starship might remain the same. 

In late-2370, Captain Keogh asked Chief O'Brien to retrofit Deep Space 9's runabouts with an extra complement of photon torpedoes prior to joining the USS Odyssey on a rescue mission to the Gamma Quadrant. 

In early 2372, Benjamin Sisko told Kasidy Yates that Deep Space 9 was being retrofitted, although in actuality it was being upgraded with new weapons systems.