A Gabor filter is some parametrization of the idea of edges. This combines two somewhat contradictory ideas: an abrupt transition AND some fuzzy idea of where it is localized.
It is mathematically a clever idea as it translates well in the Fourier domain: the Fourier transform of a Gabor is a Gaussian in Fourier space, and a Gaussian blob is the most neutral guess of something blurry you can make (think of throwing darts and looking at the patterns of hits).
As a consequence, when you use a Gabor, there is no 'right' formula: it all depends on what visual feature you want to detect. In visual neuroscience, a popular choice is to chose a Gabor that corresponds in Fourier space to a blob on the logarithm of frequencies (as from the Weber law, we are sensitive to relative differences of frequencies). These are log-Gabor filters.
To understand Gabor filters, check first what filter parameterization would be best for your particular application.