McGehee, the 2014 National League Comeback Player of the Year with the Marlins, appeared in 49 games with the Giants, where he hit .213 with two homers and 11 RBIs.
McGehee was highly popular and productive for the Marlins in 2014, batting .287 with four homers and 76 RBIs. The veteran was a vocal leader in the clubhouse.
Although McGehee played third last year, he also can play first base.
The Marlins traded McGehee to the Giants in December for Minor League right-handers Kendry Flores and Luis Castillo. The deal was made after Miami acquired Martin Prado from the Yankees.
Prado, the regular third baseman, is on the disabled list with a right shoulder injury. Prado is on rehab assignment, and on Thursday he did some throwing from across the diamond at Marlins Park. He says he still isn't at full strength, but is hopeful to return after the All-Star break.
Joe Frisaro is a reporter for MLB.com. He writes a blog, called The Fish Pond. Follow him on Twitter @JoeFrisaro and listen to his podcast. This story was not subject to the approval of Major League Baseball or its clubs.