I use to get it when i drunk vodka and other hard alcohol since it dehyrdated me so much. Since I stopped a few months ago - I'll drink a beer here and there, but as long as your hyrdrated and get some fiber in you - you golden breh. Also, don't wait to take a shyt, when you feel that urge - go ahead and take care of it, because the pressure from holding it in, only agrevates it.
I also use to get it when i drunk Green Bean's coffee when I was deployed. I ddin't connect the two, but every time I had it, it felt like i was shytting out shards of glass after an hour of drinking it.