How do I compare my local git repository to remote?

Answered

My team is transitioning from svn to git, and I'm trying to do a comparison of my local repository to the remote one.  In svn, I just go to the Version Control view, go to the Repository or Incoming tab, and do whatever comparison or update I need to do.  I don't see these options for git.  I've tried a few different things based on what I've read, like checking out remote, etc., but I can't seem to view changes coming from the remote repository.

13 comments
Comment actions Permalink

Yeah, I did that already.  I did a check-out on the remote repository, saved to a local repository, called remote-master.  My expectation is that by right-clicking on remote-master and choosing Compare, I would see a list of all files that are different, but I don't see any new files.  I can see several updated files in the repository when I view it via my browser.  I'm clearly missing a very important step somewhere.

0
Comment actions Permalink

Sorry, not sure I follow what you are doing. There is no right click, there is only left click in this menu.

Do I understand correctly that you want to compare remote-master local branch with origin/master remote branch?

0
Comment actions Permalink

Yeah, you're right.  Left-click it is.

When I click the remote-master -> origin master menu item, I get the following menu:

0
Comment actions Permalink

If you choose Compare in this menu, you will get a difference between the current local branch (master) and remote-master local branch. Probably it's not what you need. If you want to compare the current local branch (master) to the remote branch (origin/master), you should left click on the origin/master menu item and choose Compare.

0
Comment actions Permalink

It doesn't make any difference which branch I click on:  local remote-master or remote origin/master, I still can't see the changes.

0
Comment actions Permalink

Do you get the changes via the command line git log? Run git log master..origin/master in the command line.

0
Comment actions Permalink

I get the following message:

WARNING: terminal is not fully functional

0
Comment actions Permalink

If that is all you get, it means that there are no changes between the local master and remote origin/master branches and IntelliJ IDEA displays it correctly.

You need to figure out what are the actual branch names you see the changes between in your browser.

0
Comment actions Permalink

There are no branches.  Only master.

I just did a pull, and all the expected changes were brought down to my local master.  Why couldn't I see those changes before the pull?

0
Comment actions Permalink

VCS | Git | Fetch first.

1
Comment actions Permalink

All of the commits to remote happened before I did the original check-out of remote.  Would Fetch have helped there?  It seems like it would not have fetched any new changes.

0
Comment actions Permalink

So I tried a Fetch, just for fun, and I discovered something very peculiar.  Even though I did a Pull, and my local codebase is sync'd with remote, it appears that my local repo 'master' did not get sync'd?

I know we're getting into git 101 here, but why did the Pull only update my local codebase but not my local repo?  It would seem more intuitive that Pull would update local repo as well.

And this whole 'check-out to local-master' that I read somewhere seems like bad advice.  Really all that's needed is Fetch to remote in local repo, IIUC.

0

Please sign in to leave a comment.