The 25-year-old Republic of Ireland right-back made 49 appearances during his year-and-a-half stint with the Robins and replaces Luke Ayling, who left Huish Park for Ashton Gate on Monday.
"As soon as I was made aware of that Brendan was available, we moved quickly to express our interest," boss Gary Johnson told the club's official website.
"We began talking to Brendan without the knowledge that Bristol City were interested in Luke.
"We didn't know about Luke's potential move until just under a week ago.
"I am very happy with the business our club has done, I was surprised that Luke went to Bristol City but both players are good signings for their clubs."