You can view how your head commit was updated using the reflog :
$ git reflog
46f6744 (HEAD -> master, origin/master) HEAD@{0}: pull (finish): returning to refs/heads/master
46f6744 (HEAD -> master, origin/master) HEAD@{1}: pull (start): checkout 46f6744b780c1df8b0212fd297679719443874a3
e5eee0e HEAD@{2}: commit: some message
ac32fe4 HEAD@{3}: commit: some other message
...
As you can see : given the above reflog, the effect of git pull
was to move HEAD
from commit e5eee0e
to 46f6744
.
You can then view the diff between these two commits :
git diff e5eee0e 46f6744
# if you are interested in this specific file :
git diff e5eee0e 46f6744 -- src/components/Button/index.tsx
The HEAD@{xx}
mentioned in the reflog is also a valid way to specify a commit :
git diff HEAD@{2} HEAD
These commands can be run from any terminal.
Note that HEAD@{2}
may not the correct reference to look at in your case :
I have pull (start): ...
and pull (finish): ...
entries in my example because I configured pull.rebase = true
on my machine ; if the pull hadn't been a fast forward, the reflog would have registed a sequence of commits being replayed, and the "previous" state could have been HEAD@{5}
or HEAD@{11}
or ...
Inspect your reflog to understand which was the active commit before your git pull
action.
Another place of interest can be the reflog for the remote branch :
it will show you how your local view of origin/master
was updated when you ran git pull
$ git reflog origin/master
46f6744 (HEAD -> master, origin/master) refs/remotes/origin/master@{0}: pull: fast-forward
e5eee0e refs/remotes/origin/master@{1}: pull: fast-forward