Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to preview changes before git pull

I want to check the changes that will done to the files after I run git pull. I know we use git fetch to retrieve new objects from remote repository without changing local repository. But how can I view these changes in editor ?

like image 366
Paras Gupta Avatar asked Jul 18 '26 07:07

Paras Gupta


1 Answers

Assuming that all your local modifications are commited, one way would be to do:

git fetch origin

# To see local changes as the "new" version
git diff origin/yourbranch HEAD

# Or to see remote changes as the "new" version
git diff HEAD origin/yourbranch

This will compare your local repository (currently HEAD) with the remote content origin/yourbranch.

like image 103
Gaël J Avatar answered Jul 21 '26 16:07

Gaël J