How does everyone get their mind off urges? I had

How does everyone get their mind off urges?

I had to go to a gas station today and one of my old habits was to pick up some beer. Instead, I bought a case of sodas, but the want for beer is still strong a couple hours later.