githubteacher / github-for-developers-sept-2015

practice repo for the Sept 29-30 GitHub for Developers class
12 stars 36 forks source link

all the diff you showed is still "client side" is there a diff my client side readme to the github/master/readme? #702

Closed sbrinkmeyer closed 8 years ago

sbrinkmeyer commented 8 years ago

@jaw6 (just getting your attention) :smile:

jaw6 commented 8 years ago

By design, Git prefers to work offline as much as possible. diff is, basically, always going to be comparing two things on disk. What you might be trying to get at, is how to "peek" at what's coming from GitHub before pull merges those changes in?

In that case, you might want to look at git fetch. fetch is approximately half of a pull -- it updates the remote refs (eg, origin/master is updated to match what's on GitHub) but leaves local branches as is (so master is not advanced to match origin/master) -- you can think of pull as being fetch + merge.

Once you've done a fetch, you can use diff with eg, origin/<branch> to compare your local branch with whatever is on origin -- as of the last fetch. Just keep in mind that there's always some lag -- due to Git's "offline everywhere" design.