github: How to Diff Against a Forked Repository

3/2/2009 - Tim Elliott

It took me a while to figure out how to perform a diff against the remote branch that you forked. Here goes:

git fetch git://github.com/user/repo.git master:user_master
git diff --stat user_master

The first command, "git fetch" will fetch the remote branch and adds it as a local branch under the new name "user_master". For example, fetch git://github.com/why/shoes.git master:why_master.

The second command performs the diff against the local copy of the remote repository.