The teams announced the deal Wednesday. The Giants are sending a player to be named later or cash in exchange for Gennett.
Gennett, who will become a free agent after this season, has missed most of the year due to a severe groin injury. He has played in only 22 games and is hitting .217 with no home runs and five RBIs.
Before his injury, Gennett recorded at least 20 home runs and 90 RBIs in back-to-back seasons. He has a career .287 batting average with 85 homers and 354 RBIs in 771 career MLB games.
Last season, Gennett became an All-Star for the first time in his career. He finished second to Milwaukee Brewers slugger Christian Yelich for the batting crown with a .310 average.
Gennett made his 2019 debut June 28 after sustaining his groin injury during spring training. He is expected to join the Giants for their Friday matchup against the Colorado Rockies.