GA aircraft use a squat switch to prevent accidental retraction on the ground. Do airliners use a similar system? I've heard some reference to a manual pin, I'd appreciate clarification on that.
Most airliners have a protection system for this which is based on Weight-on-Wheels (WoW): sensors which detect load on the wheels (which implies that the aircraft is in contact with ground). For safety reasons this can be bypassed and there's usually a small lever in connection to the gear lever to do this. This image illustrates the 737 gear lever where you can clearly see a "lock override" which fills this functionality (red part)