It's only a 15-minute walk to the hills from the centre of Bologna. When you arrive up there, you can visit the church but first of all, have a look at Bologna from the hills, it's one of the best views on the city in a quiet green area.
The most famous place of Bologna hills is S. Luca with its church, but you can't actually see Bologna from there. Moreover the walk to San Michele in Bosco is shorter, the area is very lovely and when coming down you can also visit the most important garden/park of the town, Giardini Margherita.
If you don't feel like walking, take bus number 30 from the centre (Via Rizzoli), it takes 10 min to get there.