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. (Star Trek: The Motion Picture; Star Trek V: The Final Frontier; Star Trek VI: The Undiscovered Country)
The original USS Enterprise 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. (Star Trek: The Motion Picture)
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?" (Star Trek III: The Search for Spock)
The USS Lakota was refitted in 2372, just before Erika Benteen took command. The refit included upgrades to weapons beyond the norm for an Excelsior-class ship, including quantum torpedoes. (DS9: "Paradise Lost")
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. (Star Trek: The Motion Picture; Star Trek V: The Final Frontier; Star Trek VI: The Undiscovered Country; Star Trek Generations)
In late-2370, Captain Keogh asked Chief O'Brien to retrofit Deep Space 9's Danube-class runabouts with an extra complement of photon torpedoes prior to joining the USS Odyssey on a rescue mission to the Gamma Quadrant. (DS9: "The Jem'Hadar")