Bathe's Finite Element Procedures shows the "nonlinear strain stiffness matrix" for a 2D truss element as $$ \frac {^tP} {L_0 + \Delta L} \left[ \begin{array}{ccc} 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \\ -1 & 0 & 1 & 0 \\ 0 & -1 & 0 & 1 \\ \end{array} \right] $$
But other sources, such as this http://people.duke.edu/~hpgavin/cee421/truss-finite-def.pdf and the ANSYS theory manual, omit rows 1 and 3 (axial direction):
$$ \frac {^tP} {L_0} \left[ \begin{array}{ccc} 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & -1 \\ 0 & 0 & 0 & 0 \\ 0 & -1 & 0 & 1 \\ \end{array} \right] $$
The extra 1's don't seem to be physically correct according to my intuition. They say the element becomes stiffer when it's under tension. That suggests the force/displacement relationship is not linear in a seemingly arbitrary way.
Bathe does say "Note that if the material stress-strain relationship is such that $^tP$ is constant with changes in $\Delta L$, [then something that seems to lead to the extra 1's being omitted]"
Perhaps it's using a generalization of Hooke's law which is nonlinear but doesn't have any extra parameters?
My experiments with nonlinear solid elements in Calculix show the same behavior as these truss elements with the extra 1's present.
EDIT: Using the full diagonal matrix with pre-stressed frequency analysis leads to what seems like an incorrect result - a 1D spring-mass system's natural frequency increases with tension on the spring. In other words, this common physics concept of gravity not influencing the motion described here is violated. https://share.ehs.uen.org/sites/default/files/Unit02Lesson2.pdf The same problem occurs with solid elements in Calculix. Are they really wrong?
EDIT 2: Example showing that the full-diagonal matrix does not work for pre-stressed frequency analysis. It's a 1D spring with length 1, spring constant k, mass m concentrated at each node and no constraints.
The natural frequency should be independent of P. We can see this is true when using the 2nd geometric stiffness matrix above by solving the eigenvalue equation $$ (\textbf K_e + \textbf K_g - \omega^2 \textbf M) \textbf u = 0 $$ I form the 1D matrix by taking on the 1st and 3rd rows and columns from the 2D matrix above.
$ \textbf K_e = \left[ \begin{array}{rr} k & -k \\ -k & k \\ \end{array} \right] $ $ \textbf K_g = \left[ \begin{array}{rr} 0 & 0 \\ 0 & 0 \\ \end{array} \right] $ $ \textbf M = \left[ \begin{array}{rr} m & 0 \\ 0 & m \\ \end{array} \right] $
which has the non-zero eigenvalue $ \omega^2=\frac{2k}{m} $. This is consistent with a simple spring-mass oscillator. The factor of 2 appears because it's really two 1-dof oscillators with half the spring each.
Now, if we use the first geometric stiffness matrix above, with $ \Delta L $ approximately 0, we get the wrong answer: $$ (\textbf K_e + \textbf K_g - \omega^2 \textbf M) \textbf u = 0 $$ $ \textbf K_e = \left[ \begin{array}{rr} k & -k \\ -k & k \\ \end{array} \right] $ $ \textbf K_g = \left[ \begin{array}{rr} P & -P \\ -P & P \\ \end{array} \right] $ $ \textbf M = \left[ \begin{array}{rr} m & 0 \\ 0 & m \\ \end{array} \right] $
This has a non-zero eigenvalue of $ \omega^2=\frac{2(k+P)}{m} $. It's apparently wrong because it's a function of P but it should be independent of P. It shows that a spring is stiffened by increased tension. Conversely, if P is negative, it also shows that compression softens it and it even becomes unstable when P=-k. This indicates axial buckling (not Euler column buckling) under compression, which seems to be unphysical. Even if $\Delta L$ is not zero, it can't make $\textbf K_g$ zero, so there will always be some discrepancy.
So I'm wondering if the matrix with the full diagonal above is really correct. At least it appears to be wrong when used for frequency or linear buckling analysis. Solid elements in Calculix follow this "incorrect" behavior for frequency analysis, which adds to the confusion.