Barwick has played eight times for the Cods since joining them in the summer, after he was released by Scunthorpe.
The Doncaster-born player has joined the Minstermen until the end of the year.
He made 69 first-team appearances for Scunthorpe, scoring once - in the 6-2 win over Huddersfield Town in 2003.