Git Examples: Comparing Branches, locally and remotely

Git Examples: Comparing Branches, locally and remotely

Last updated:
Table of Contents

Unless otherwise stated, we're using Git v2.x

WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.

Compare working directory with remote branch

Run git fetch --all first so your local remotes are synced with the remotes

Suppose you have a local directory with unmerged changes and you want to compare it with a branch on github.

Suppose the other branch you want to compare against is called my-other-branch and origin is a remote pointing to github.

$ git fetch --all 
$ git diff origin/my-other-branch

Compare two arbitrary branches

TODO

Dialogue & Discussion