The North British Railway was opened in 1846 as the line from Edinburgh to Berwick-upon-Tweed, and its workshops were initially situated in St. Margarets, Edinburgh. Gradually other railways were acquired, including in 1865 the Edinburgh and Glasgow Railway, whose works at Cowlairs, Glasgow were better than that at St. Margarets, which were reduced to repairs only and all production moved to Cowlairs. These are not complete lists, as most engines acquired second-hand and from absorbed companies are not included.