Cahill, 31, joined the Los Angeles Angels on a one-year, $9 million contract in December 2018 but posted a 6.92 ERA in his first 11 starts and spent the final four months in an inconsequential bullpen role.
Cahill was a consistent starter early in his career, averaging 186 innings and a 3.89 ERA for the Oakland Athletics and Arizona Diamondbacks from 2009 to 2013. He struggled the next two years, became an effective reliever for the Chicago Cubs in 2016 and was inconsistent with the San Diego Padres and the Kansas City Royals the following season.
Cahill again found success when he rejoined the A's in 2018, posting a 3.76 ERA and a 1.19 WHIP in 110 innings, the vast majority of which came as a starting pitcher. A ground ball pitcher by trade, Cahill has averaged 3.7 walks and 6.8 strikeouts per nine innings in his 11-year career, going 84-92 with a 4.21 ERA.
The Giants on Wednesday also finalized a a two-year, $6.25M deal with versatile infielder Wilmer Flores after agreeing to a deal earlier this month.
ESPN's Alden Gonzalez contributed to this report.