In this question, the LFSR is a Galois-field LFSR.
If $F(X) = \sum_{i=0}^{n-1} f_iX^i$, where $f_i \in \mathbb F_q$, then
the initial contents of the LFSR can be interpreted as the element
$$\beta = f_0 +f_1\alpha + \cdots + f_{n-1}\alpha^{n-1} \in \mathbb F_{q^n}$$
where $\alpha$ is a primitive element of $\mathbb F_{q^n}$ whose minimal
polynomial is $g(X)$. Then the next contents of the shift
register are $XF(X) \bmod g(X)$ which is just the element $\beta\alpha$,
and so on, with the $i$-th contents being $X^iF(X) \bmod g(X)$ which
is the element $\beta\alpha^i$.
Turning to the mechanics of the LFSR, the initial contents are $F(X)$.
Now, $g(X) = X^n + g_{n-1}X^{n-1} + \cdots + g_1X + g_0$ and so
$$\begin{align*}
XF(X) &= f_0X + f_1X^2 + \cdots + f_{n-2}X^{n-1} + f_{n-1}X^n\\
&\equiv -f_{n-1}g_0 + (f_0-f_{n-1}g_1)X + \cdots + (f_{n-2}-f_{n-1}g_{n-1})X^{n-1} \bmod g(X)
\end{align*}
$$
where the second equation is obtained from the first by subtracting $f_{n-1}g(X)$
from the right side of the first. Note that the individual symbols in the
LFSR change instead of just shifting over with a new symbol being introduced
at one end as happens in Fibonacci LFSRs. In more detail, if the LFSR
contains
$$
\mathbf f^{(i)} = (f_0^{(i)}, f_1^{(i)}, \cdots, f_{n-1}^{(i)})
$$
after $i$ iterations (initial contents $\mathbf f^{(0)} = (f_0, f_1, \cdots, f_{n-1})$), then the LFSR contents after $i+1$ iterations are
$$\begin{align*}
\mathbf f^{(i+1)} &= (f_0^{(i+1)}, f_1^{(i+1)}, \cdots, f_{n-1}^{(i+1)})\\
&= (-f_{n-1}^{(i)}g_0, f_0^{(i)}-f_{n-1}^{(i)}g_1, \cdots,
f_{n-2}^{(i)}-f_{n-1}^{(i)}g_{n-1}).
\end{align*}
$$
Thus, $\mathbf f^{(i+1)} = \mathbf f^{(i)}\mathbf G$ where $\mathbf G$ is
the companion matrix of
$g(X)$.
The output of the LFSR is the contents of the rightmost cell, i.e.,
$h_i = f_{n-1}^{(i)}$, and the sequence $(h_0, h_1, \ldots)$ is
an m-sequence of period $q^{n}-1$ over $\mathbb F_q$.