The move is retroactive to June 4. Cole, 23, is 6-3 with a 3.64 ERA for the Pirates this season.
Locke returned to the form that earned him a bid to the 2013 All-Star Game, allowing three hits and a run in seven innings, but he took the loss in Milwaukee's 1-0 win.
Locke struck out five and walked three while pitching in place of Charlie Morton, whose start was pushed back a day.
Information from The Associated Press was used in this report.