Compare local repo to GitHub repo

I edited a file on my GitHub repo (origin/master) and committed it. I want to be able to compare my local repo to GitHub. I expect to see that one (or more) of the files on GitHub are different from what I have locally.

On the local:

$ git remote -v
origin	https://github.com/<account>/<repo> (fetch)
origin	https://github.com/<account>/<repo> (push)

but

$ git log --oneline --decorate --graph --all
* 42f3624 (HEAD -> master, origin/master) print usage def
* d6d0d0e bad file name bug fixed

is not showing me the commit that was made on GitHub. I’m expecting to see something about commit ef714fa

Commits on Oct 4, 2020
Added less -R  …
@<account> committed 41 minutes ago Verified  ef714fa  

Commits on Sep 25, 2020
print usage def
@<account> committed 9 days ago 42f3624  

Did you do a git fetch origin to get updates from the repository on Github? git log operates only on the locally known data.

I had not done a fetch. As I read about that command, it makes sense. I guess that when I saw a reference to origin/master in the 42f36 commit (see below), it was telling me how things are right now.

$ git log -3
commit 42f36242037e8d7652f151785cdac618da738e0d (HEAD -> master, origin/master)
Author: MACE <maceww6438@gmail.com>
Date:   Fri Sep 25 11:58:14 2020 +0000

    print usage def

But I guess it shows how things were the last time the local repo looked at the remote repo. That “look” happened on my last push. And I’ll need something else to cause a “look” – like a fetch.

Thanks for the enlightenment!

1 Like