As you surely know, the final consonant of some verbs gets doubled when the suffix -ing or -ed is added, e.g.
cram: cramming, crammed
In other cases, it is not doubled:
shift: shifting, shifted
The rule governing the doubling of the final consonant is actually quite simple. If a verb has just one syllable and ends with exactly one vowel followed by one consonant (except “w”, “x”, and “y”, which we will explain below), the consonant is doubled:
sit: sitting, (past tense: sat)
beg: begging, begged
hum: humming, hummed
If there are two vowels or two consonants at the end, no doubling occurs:
coat: coating, coated
bark: barking, barked
fill: filling, filled
This applies also to “oo” and “ee”:
seed: seeding, seeded
Similarly, if a verb ends with a silent “e”, do not double the preceding consonant:
come: coming, (past tense: came)
hope: hoping, hoped
game: gaming, gamed
The letters “w” and “y” are never doubled (they act as vowels in this context, pronounced /ʊ/ and /ɪ/, respectively):
stay: staying, stayed
Similarly, the letter “x” is never doubled, because it represents two consonants “ks”:
vex: vexing, vexed
Words beginning with “qu” may seem like an exception to the rule, but “qu” is actually pronounced as “kw”, i.e. as two consonants, which does not prevent the following vowel from doubling:
quit: quitting (past tense is usually just “quit”)
The rule can be summarized as:
(in monosyllabic words; except -w, -x, -y)
How does the rule apply to polysyllabic words? I will describe all the details in another article. In the meantime, you can check out my book, which describes all the rules and exceptions.