How can I see the differences between two branches?

You want to use git diff.

git diff [<options>] <commit>..​<commit> [--] [<path>…​]

Where <commit> is your branch name, the hash of a commit or a shorthand symbolic reference

For instance git diff abc123…def567 or git diff HEAD..origin/master

That will produce the diff between the tips of the two branches. If you’d prefer to find the diff from their common ancestor to test, you can use three dots instead of two:

git diff <commit>...<commit>

And if you just want to check which files differ, not how the content differs, use --name-only:

git diff --name-only <commit>..​<commit>

Leave a Comment