Using VSCode, how do I compare two non-consecutive commits on a file in Gitlens
Answer a question
When I use Gitlens in VScode, I cannot find an option to compare commits on a file when they are not consecutive. If I use 'open changes' on a certain commit in the 'File History' panel, it always compares that version of the file with the previous one. Is there a way to choose to compare one revision of the file (and not necessarily the latest revision) with another revision of my choosing of that file?
Answers
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.
更多推荐
所有评论(0)