Given are two vectors ${\bf g}_1, {\bf g}_2\in\mathbb{R}^N$ with non-zero scalar-product ${\bf g}_1^\top{\bf g}_2 \ne 0$. Then there exist three unique (up to the sign) orthonormal unit vectors ${\bf e}_1, {\bf e}_2, {\bf e}_3$ and non-zero scalars $\alpha_i, \beta_i$ such that
$${\bf g}_1 = \alpha_1{\bf e}_1 + \alpha_2{\bf e}_2$$ $${\bf g}_2 = \beta_1{\bf e}_1 + \beta_2{\bf e}_3$$
Question: How can I extract the "common direction" ${\bf e}_1$ given just the vectors ${\bf g}_1$ and ${\bf g}_2$?
Update 1: The answer by Cave Johnson seems correct in that the decomposition is not unique. To give a concrete toy example, consider
$${\bf g}_1 = \left( \begin{array}{c} 1\\ 1\\ 0\\ \end{array} \right), {\bf g}_2 = \left( \begin{array}{c} 1\\ 0\\ 1\\ \end{array} \right).$$ There are two simple splittings one can make: $${\bf g}_1 = \left( \begin{array}{c} 1\\ 0\\ 0\\ \end{array} \right) + \left( \begin{array}{c} 0\\ 1\\ 0\\ \end{array} \right)$$ $${\bf g}_2 = \left( \begin{array}{c} 1\\ 0\\ 0\\ \end{array} \right) + \left( \begin{array}{c} 0\\ 0\\ 1\\ \end{array} \right)$$ or $$ \begin{align} {\bf g}_1 &= \,1\left( \begin{array}{c} 1\\ 1\\ 0\\ \end{array} \right), \\ {\bf g}_2 &= \frac{1}{2}\left( \begin{array}{c} 1\\ 1\\ 0\\ \end{array} \right) + \left( \begin{array}{c} 1/2\\ -1/2\\ 1\\ \end{array} \right) \end{align}$$
I think a condition that $\mathbf{g}_1, \mathbf{g}_2$ are not parallel is missing in the problem. Given that condition, the problem can be simply reduced to a 3-dimensional one. In fact, $\mathbf{g}_1, \mathbf{g}_2$ span a 2-dimensional subspace of $\mathbb{R}^n$. Adding a vector orthogonal to this subspace yields a new 3-dimensional subspace, and then we only need to find $\mathbf{e}_1, \mathbf{e}_2, \mathbf{e}_3$ in this subspace.
Now the problem can be solved easily in a geometric way. Take $\mathbf{e}_1,\mathbf{e}_2$ two orthonormal vectors such that $\mathbf{g}_1$ lies in the plane they span, which is denoted by $\Sigma$. Then choose $\mathbf{e}_3$ the unit vector orthogonal to $\Sigma$. Since $\mathbf{g}_1,\mathbf{g}_2$ is not orthogonal, $\mathbf{g}_2$ is not parallel to $\mathbf{e}_3$. One may choose a proper $\beta_2$ such that $\mathbf{g}_2-\beta_2\mathbf{e}_3$ lies in $\Sigma$. Now rotate $\mathbf{e}_1,\mathbf{e}_2$ around the axis $\mathbf{e}_3$ to make $\mathbf{e}_1$ parallel to $\mathbf{g}_2-\beta_2\mathbf{e}_3$. Then we're done. The uniqueness seems not to be true.