Read Anthropic’s case study about Graphite Reviewer

How to git diff between tags

Greg Foster
Greg Foster
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


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.

Join 20,000+ developers at top companies
Stop wrestling with Git commands
The Graphite CLI takes all the pain out of Git, allowing you to ship faster and stop googling Git commands.
main
diff1
diff2

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.

Join 20,000+ developers at top companies
The best engineers use Graphite to simplify Git
Engineers at Vercel, Snowflake & The Browser Company are shipping faster and staying unblocked with Graphite.
main
diff1
diff2

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.

Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2