1

We have to copy over files to an archaic live server for reasons I can't control so I need to see a diff of what the remote working copy will be compared to my local working copy (which is at a different base).

What are the command lines for this? I've tried several things and they either just hang or don't give the output I need.

Dave Heq
  • 306
  • 3
  • 16
  • 1
    Why would the working directory on this server be different from the actual commit that was last checked out? Is something actually making changes to the working files? – meager Feb 06 '16 at 00:13
  • How are the remote files accessible? Via ssh/sftp? – user3159253 Feb 06 '16 at 00:15
  • @meagar Where did it say the files will be different from the commit? That's not how I understood the question – Rob Feb 06 '16 at 00:29
  • Possible duplicate of [compare local git branch with remote branch?](http://stackoverflow.com/questions/1800783/compare-local-git-branch-with-remote-branch) – Whymarrh Feb 06 '16 at 00:30

2 Answers2

2

Assuming your remote is named as origin and you are trying to compare your local branch named as master with the remote branch named master, first fetch the remote changes using:

git fetch

then compare your local to the remote using:

git diff origin/master

Visit git diff documentation for more info.

Dharam Gollapudi
  • 5,962
  • 2
  • 29
  • 40
1

A commit defines the whole contents of the working copy. If both sides checked out the same commit they will show the same contents. (Unless you did some manual changes afterwards.)

If both sides were cloned from the same (central) repository, but use different commits of that (say first_hash and second_hash), you can use git fetch got get all commits of that repository and then do something like git diff first_hash second_hash to see the differences between both versions.

michas
  • 22,506
  • 9
  • 64
  • 105