GitHub Repository Remote Local Comparison

Comparing Remote and Local for a GitHub Repository

There are cases where you want to diff and compare files between a remote GitHub repository and a local repository.

Shou Arisaka
1 min read
Oct 3, 2025

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.

Share this article

Shou Arisaka Oct 3, 2025

๐Ÿ”— Copy Links