Back in the British Isles of more than a thousand years ago, sloping off in a group to pummel the crew from the next town or county was common enough that everybody knew the first steps were to “kilt” your skirt or robe so your legs would be free (possibly to run the other way if things weren’t working out as you hoped), and to “gyrdan” your clothes, which meant to put on a belt. The belt might serve as a holder for your sword if you were wealthy, or your club if you weren’t. “Gyrdan” survived the evolution from Old English to Middle and Modern English, where we know it as “gird.” It’s still fairly common to encounter “gird” used in the metaphorical sense of getting yourself prepped for something as in this 1860 quote: “He was already girding himself for his life’s work.”
“Gird” turns up in some other places too; “girdle” as a noun originally meant a belt. When used as a verb (Pittsburgh is girdled by three rivers) it means to be surrounded. In the 1600s the word “girder” entered use as well; the “-er” attached seems like it would mean the person who does the girding, just as a “driver” drives, a “supporter” supports, and a “collier”…um…well you get the idea. But in the case of “girder” the “-er” is not personified; it simply means reliably or firmly attached. Since the word’s first appearance it’s been used to mean the a primary supporting beam in a building. In the 1600s that meant it was the trunk of a tree hacked into a roughly square cross section, while nowadays, of course, it usually refers to a steel, concrete, or composite unit.
The original “gird” had a lot to do with battle, or at least prepping for battle. Even attaching a saddle to a war horse was known as “girding.” So you might think that since the words sound similar, “guard” is another derivation, but that turns out to be just a coincidence. “Guard” didn’t show up in English until the 1400s, and it came from the Middle French “garde,” which meant the same thing that we mean by “guard” and “guarding.” “Guard” followed an unusual linguistic path into English; although we acquired it from French, further back it came from the Germanic word “wardo” (to guard), and instead of going directly to Old English, which is the way we got many, if not most English words with ancient Germanic origins, we didn’t borrow “guard” until it made its way into Old North French, down into France, and then made the trek back up north with the Normans.
You might also think that because “gird,” particularly in the form “girdle,” refers to surrounding something, “grid” might be related too. After all, a city is “girdled” by roads and highways, and those can suffer “gridlock.” But it’s just another coincidence; “grid,” surprisingly enough, comes from “gridiron” — the metal grate you place over the fire to cook steaks in the parking lot while you’re waiting for the football teams to show up on the, um, gridiron. “Gridlock” is quite recent; supposedly coined in the Dept. of Transportation for New York City in the 1970s — in fact, it’s even attributed to a single person, Sam Schwartz, who was the chief traffic engineer at the time. But a “grid” is just a shortened version (a back formation) from the original cooking grate. The set of interconnected, crossed elements turned out to be useful well beyond the cooking fire, so “gridiron” was girded so tightly it dispensed with the “-iron” part and now we have everything from electrical grids to web page layouts.