Unable to see differences in remote branch after git fetch

I got a little confused in git fetch and compared the differences.

I have the following local branches:

  • master
  • remote / origin / master

In the master branch, I have a text file in which I make changes, make and then click on the start / master.

In another local repo (for test purposes), I have deleted the same repos as above. I launched

  • git fetch main host
  • git diff master origin / master

There are no differences in it, but if I do git pull origin master , it extracts and merges the changes made to the text file. I am probably mistaken, but I thought that the attraction made the selection and the merge, so when I performed the selection, I was able to see the changes in the remote branch before they were merged.

+6
source share
1 answer

What you need to do to make diff (after extraction) with respect to the head of your branch, and the beginning in the same branch -

git diff HEAD...origin

Pay attention to 3 points. By the way, the question can be considered as a duplicate of this , at least from the point of view of the accepted answer.

+7
source

Source: https://habr.com/ru/post/898365/


All Articles