You can compare two nonconsecutive commits via the following steps (assuming you have the Gitlens extension installed):
- Source Control tab (or Gitlens tab) -> Open the Branches menu.
- From the branches menu -> Open the branch of interest.
- Right click on a particular commit and select “Select for Compare”
- Similarly, find the other commit you’re interested in, right click and select “Compare with Selected”
You will see that under the “Search & Compare” menu, your two different commits are compared.
edit note: you might not see a Gitlens tab anymore as it was (optionally) merged with the Source Control tab, in version 11.2.1.