Pulling off the old knobs and installing knobs that are compatible with that particular model of gas stove complete the process of replacing the knobs. The heating and cooling that come with cooking can make these knobs brittle, and twisting them with too much force can break them as well.
Wait until the gas stove burners are off and completely cool before removing the existing knobs. Pull them straight away or straight up, depending on the placement. A D-shaped shaft holds most gas stove knobs in place through friction. Leave any seals under the knobs in place. If grease or other residue makes pulling the knobs difficult, use a pair of pliers to pull them off.
Ensure that the new knobs are designed for a gas stove and fit your particular model. On electric stoves, the shafts have a different shape than they do on a gas stove. Dampen a sponge or soft rag with window cleaner, and clean off the shafts with the cloth. Push the replacement knobs onto the shafts until they stop. Test them by turning the burners on and off. If the burners do not function properly but the knobs are in place, you need to troubleshoot the burners using the instructions in your owner's manual.