Let $f,g$ be irreducible binary quadratic forms with integer coefficients. Define the twisted action of $\operatorname{GL}_2(\mathbb{R})$ on $f$ by

$$\displaystyle f_T(x,y) = \frac{1}{\det T} f(t_1 x + t_2 y, t_3 x + t_4 y)$$

with $T = \left(\begin{smallmatrix} t_1 & t_2 \\ t_3 & t_4 \end{smallmatrix} \right)$. Then whenever $f$ and $g$ have the same discriminant, they are equivalent with respect to $\operatorname{GL}_2(\mathbb{Q})$-twisted action. To see this, put $f = f_2 x^2 + f_1 xy + f_0 y^2$ with $\Delta(f) = f_1^2 - 4 f_2 f_0$. Then $f$ is equivalent to $x^2 - \frac{\Delta(f)}{4}y^2$ via the map $T = \left(\begin{smallmatrix} 2 & -f_1 \\ 0 & 2 f_2 \end{smallmatrix} \right)$. Thus $f$ is equivalent to $g$ via the map $T' = \left(\begin{smallmatrix} 2 & -f_1 \\ 0 & 2 f_2 \end{smallmatrix}\right) \left(\begin{smallmatrix} 2 g_2 & g_1 \\ 0 & 2 \end{smallmatrix} \right)$. It is therefore enough to know that $f,g$ have integer coefficients, irreducible over $\mathbb{Q}$ and that $f,g$ are equivalent over $\operatorname{GL}_2(\mathbb{R})$ to ensure that they are $\operatorname{GL}_2(\mathbb{Q})$-equivalent.

What about $\operatorname{GL}_2(\mathbb{Z})$-equivalence? Suppose we know that $f,g \in \mathbb{Z}[x,y]$ and $\Delta(f) = \Delta(g)$ not a square, and for each prime $p$, there exists $T_p \in \operatorname{GL}_2(\mathbb{Z}_p)$ such that $f_{T_p} = g$. Does it follow that $f,g$ are $\operatorname{GL}_2(\mathbb{Z})$-equivalent?