How to git diff between tags

Greg Foster
Greg Foster
Graphite software engineer

Tags in Git are references to specific points in a repository's commit history, usually used to mark release points (v1.0, v2.0, etc.). You can use the git diff command to compare two snapshots of a project and examine the difference between these points.

Here’s how you can use Git to compare the differences between two tags:

To start, you might want to list the available tags in your repository to identify which tags you want to compare.

Terminal
git tag

This command will display all tags in your repository, allowing you to choose the ones you're interested in comparing.

To see the differences between two tags, use the git diff command followed by the tag names.

Terminal
git diff tag1 tag2

Replace tag1 and tag2 with the names of the tags you want to compare. This will show you the diff output directly in your terminal, indicating what has changed from tag1 to tag2.

Terminal
git diff v1.0 v2.0

This command compares the project state between two releases, showing changes made from version 1.0 to 2.0.

While the basic git diff tag1 tag2 is useful for local repositories, you might need more complex comparisons, involving specific commits between tags.

To see the list of commits between two tags, which can help you understand the progression of changes, use:

Terminal
git log tag1..tag2 --oneline

This will list the commits between tag1 and tag2, providing a concise summary of each commit. If you want to see the detailed differences introduced by each of these commits, you can use:

Terminal
git log tag1..tag2 -p

The -p option shows the patch representing each commit, essentially showing the git diff for each commit in the range.

For further reading see the official Git documentation.

Stay unblocked. Ship faster.
Experience the new developer workflow - create, review, and merge code continuously. Get started with one command.
Get started

Give your PR workflow
an upgrade today

Stack easier | Ship smaller | Review quicker

Or install our CLI.
Product Screenshot 1
Product Screenshot 2