History: From LCDR Charles Breen, USN, who tried to untangle a goat's rope, only to be bitten by said goat, then to deck same goat, Mongo style, right as busload of tourists rounded the bend in time to think he was beating the crap out of a goat for no reason. This definition dates back to at least 1988.
To teach new cowboys the art of roping a moving target, such as a horse or a steer, novices would be put in a pen full of goats, which were smaller and less dangerous, to hone their craft. The old-timers would gather to watch, drink, whoop and be amused by the ensuing melee. It was not a pretty sight.
I'm a writer with a book of the same name and I did extensive research to find the origins of this term.
So it is any stupid action that leads one to get themselves or others into a no-win situation that could have been avoided.