git: check diff between local working copy and remote working copy
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.
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.
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.
上一篇: 列表无法检测远程/原点更改?