There are cases where you want to diff and compare files between a remote GitHub repository and a local repository.
When you execute git pull, the remote repository overwrites the local repository. If youโre in the middle of development in your local environment, this could lead to unfortunate results. In such cases, the following steps are recommended:
git fetch origin
git diff master origin/master
git merge
git - How to check the differences between local and github before the pull - Stack Overflow
git pull is really equivalent to running git fetch and then git merge.