0

I've got a repository set up and added files and pushed it ok.

Then another person cloned it on a separate pc, made some changes and pushed it also.

Now back on my pc, how can I get a difference between what's on my PC and the online repository (which is more up to date).

doing a git status - says I'm up to date with origin/master.

I don't think either of us did any branching - so we should be on the master branch.

Thanks.

dashman
  • 2,858
  • 3
  • 29
  • 51
  • Why dont you checkout the entire branch in both of the machines one more time. That will be a Sync branch check out in both the places – Ranadip Dutta Jan 25 '17 at 15:23

3 Answers3

1

Your local needs to actually make a call to see that the online repo has been updated. Run git fetch. Then you should see that your master is behind origin/master by x commits.

Git keeps a record of where it knows the remote state and uses this in git status. It doesn't connect to the remote until you tell it to with git fetch or git pull (which is a combination of git fetch and git merge).

Schleis
  • 41,516
  • 7
  • 68
  • 87
1

The best way to compare the changes is to check the commits one by one. Go to your remote & check the commit history. You will see that another persons commits in the history.

If you have any commits that you didn't push to master yet, it's better to create a separate branch from your current state by, git checkout -b BRANCHNAME & push it to the remote.

Then you can create a pull request from your newly created branch to master & can see the difference between two branches.

DilumN
  • 2,889
  • 6
  • 30
  • 44
0

Run the Git Pull Command to get the difference code on to you local repository.

If you had any commits on your local repository then you need to merge the Remote code with you local repositories code. If not then the code gets merged automatically for you.

Sunny
  • 1
  • if he wants to only check differences between local and remote, without merging, can't do `git pull`. See instead http://stackoverflow.com/questions/6000919/how-to-check-the-differences-between-local-and-github-before-the-pull – carmine Jan 25 '17 at 15:47
  • Yes, that's correct. – Sunny Jan 25 '17 at 16:01