To elaborate on Anton Orlov's answer regarding fetch-depth.
To have git diff the current HEAD (depth:1) against the previous commit (depth:2), then one needs to have at least fetch-depth: 2, and if one wants to diff against deeper history one must set the depth accordingly. Many git work flows only fetch a depth:1 as an optimization, to avoid expensive IO copying entire repos when only the single commit is needed.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's because you fetch only latest commit. You can solve this issue by setting
fetch-depth
to 0 to retrieve full git history.To elaborate on Anton Orlov's answer regarding
fetch-depth
.To have
git
diff the current HEAD (depth:1) against the previous commit (depth:2), then one needs to have at leastfetch-depth: 2
, and if one wants to diff against deeper history one must set the depth accordingly. Many git work flows only fetch adepth:1
as an optimization, to avoid expensive IO copying entire repos when only the single commit is needed.