Lincecum last pitched on June 27, against the Rockies. He went 1 2/3 innings and left after being hit in the right forearm by a DJ LeMahieu line drive. Lincecum was 7-4 with a 4.13 ERA through 15 starts, his lowest ERA since 2011.
By undergoing the surgery now, he should be completing his rehab in time for Spring Training in 2016.
"Trust me, Timmy still wants to pitch -- he still has that fire in the belly," Bochy said. "That's probably the biggest reason why he had this surgery, so he could get this behind him, get his rehab done and get back on the mound and hopefully get back to where he was and comfortable on the pitching side of it."
According to Giants head athletic trainer Dave Groeschner, the surgery involved fixing an impingement by shaving down some bone that had built up on the hip.
"The doctor was pretty confident this is going to help Timmy out and he'll get back to Major League pitching for next season," Groeschner said. "He's been dealing with this for a few years now. We've been trying some rehab programs, stretching, strengthening. But it just kind of came to a head this season. He noticed that it was affecting the way he wanted to throw. You try to avoid this, but if you can't pitch, this is where you got to go."
Part of the surgery also included repairing Lincecum's torn labrum.
"Timmy was battling to try and get back to pitch this year," Groeschner said. "He was working really hard. He took a couple cortisone shots six weeks ago. ... As he continued to try and throw off the mound and get back and get out there, it just wasn't working. He did everything he could to try and avoid surgery. He wants to get back to being Tim Lincecum."
Lincecum is expected to begin his rehab program on Friday, remaining in Vail through the weekend, then he'll head to Arizona to work with the Giants' physical therapist at their Spring Training complex.
Beyond that there is uncertainty about Lincecum's long-term future, given the fact that his contract runs out at the end of this season.
"I love Timmy," Bochy said when asked about Lincecum's future in San Francisco. "He's a great teammate, and we all know what Timmy has done for the Giants. My door will always be open for Tim Lincecum. That's how much I think about him."