Is there a name for a group where elements either commute or anti-commute? An abelian group is a group where each element commutes with any other element in the set, so $ab=ba$.
I was reading the wikipedia article on the anticommutative property. I think this could be generalised to arbitrary groups as follows:

Suppose $G$ embed into the group of units of some ring $R$ (so for $g\in G$ the element $-g$ makes sense, as $-1$ is a unit). Then $a, b\in G$ anticommute if $ab=-ba$.

Another, possibly more general, interpretation is:

Let $-1$ be a distinguished central element of order two in $G$ (so for $g\in G$ the element $-g=g(-1)=(-1)g$ makes sense). Say that $a, b\in G$ anticommute with respect to $-1$ if $ab=-ba$.

I was therefore wondering: Is there a specific name for a group where any two elements in the group either commute or anti-commute (with respect to a fixed element $-1$)? That is, for $a,b$ in $G$ either $ab=ba$ or $ab=-ba$.
 A: It's possible to make sense of this question as follows. Let $G$ be a group together with a distinguished central element of order $2$ which we call $-1$; we'll write the product $(-1)a$ as $-a$. Say that two elements $a, b \in G$ anticommute if $ab = -ba$. Then we have, more or less by definition:

Claim: Every pair of elements in $G$ either commutes or anticommutes iff the quotient $G/\{ 1, -1 \}$ is abelian.

So the desired groups are precisely the central extensions of abelian groups by $C_2$. These groups are 2-step nilpotent, and in the finite case every such group must have the form $G = G_1 \times G_2$ where $G_1$ is an abelian group of odd order and $G_2$ is a central extension of an abelian $2$-group by $C_2$.
The two smallest nonabelian examples of such groups are the quaternion group $Q_8$ and the dihedral group $D_8$, which are central extensions of $C_2 \times C_2$ by $C_2$. See the Wikipedia article on extraspecial groups for more. $D_8$ is also isomorphic to the Heisenberg group $H_3(\mathbb{F}_2)$.
The group algebra $k[G]$ of such a group has a distinguished quotient where we identify $-1 \in G$ with the actual element $-1 \in k[G]$ (apologies for the abuse of notation); this is a certain twisted group algebra of $G / \{ 1, -1 \}$. Applying this construction to the quaternion group $Q_8$ over $k = \mathbb{R}$ produces the quaternion algebra $\mathbb{H}$.
