We know if a push
command uses a refspec
which has +
sign, it will overwrite dst
completely (non-fast-forward
update) so dst
and src
will be the same. But is that true if a fast-forward
update occurs?
But is that true if a fast-forward update occurs?
Yes, considering a fast-forward simply moves the remote head dst to src (because src only adds new commits)
--r--r--r--o--o--o (src)
|
(origin/dst)
git push +src:dst
--r--r--r--o--o--o (src)
|
(origin/dst)
From git push
:
By having the optional leading
+
, you can tell Git to update the<dst>
ref even if it is not allowed by default (e.g., it is not a fast-forward.)
That means: if the push is a fast-forward one, the '+
' has no effect.