{"id":257505,"date":"2026-10-21T07:00:30","date_gmt":"2026-10-21T14:00:30","guid":{"rendered":"/__p/devblogs.microsoft.com\/visualstudio\/?p=257505"},"modified":"2026-10-14T10:02:30","modified_gmt":"2026-10-14T17:02:30","slug":"compare-todays-code-with-an-earlier-commit","status":"publish","type":"post","link":"/__p/devblogs.microsoft.com\/visualstudio\/compare-todays-code-with-an-earlier-commit\/","title":{"rendered":"Compare today&#8217;s code with an earlier commit"},"content":{"rendered":"<p>You know a change was present in an earlier commit, and you want to see how the code in front of you differs now. Comparing two commits answers part of that question, but it leaves out work you haven&#8217;t committed yet.<\/p>\n<p>Visual Studio 2026 version 18.11 adds <strong>Compare with Working Tree<\/strong> to the repository-level commit workflow. You can compare a historical commit with your current code without checking out that commit or leaving your current branch.<\/p>\n<ol>\n<li>Open commit history or use the branch list to reach the commit you want to inspect.<\/li>\n<li>Right-click the commit and select <strong>Compare with Working Tree<\/strong>.<\/li>\n<li>In the compare view, select changed files to inspect their diffs.<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"/__p/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/10\/compare-working-tree-command.webp\" alt=\"Commit context menu in Git Repository with Compare with Working Tree selected\" \/><\/p>\n<p>The selected commit is the baseline which gets compared with your working tree. Visual Studio will list every file that differs, not just the ones changed in that commit.<\/p>\n<p><img decoding=\"async\" src=\"/__p/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/10\/commit-working-tree-diff.webp\" alt=\"Side-by-side comparison of Calculator.cs at a historical commit and in the working tree, with changed files listed on the right\" \/><\/p>\n<p>See <a href=\"/__p/learn.microsoft.com\/visualstudio\/version-control\/git-browse-repository?view=visualstudio\">Browse your repository history in Visual Studio<\/a> to trace when a problem was introduced or to check out a commit and run older code.<\/p>\n<p>Thanks for the <a href=\"https:\/\/developercommunity.visualstudio.com\/content\/idea\/370956\/allow-compare-working-copy-to-historical-version-v.html\">community request<\/a> that led to this feature. Keep sharing your ideas and issues on <a href=\"https:\/\/developercommunity.visualstudio.com\/\">Developer Community<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compare a historical commit with your working tree without checking out the commit or leaving your branch.<\/p>\n","protected":false},"author":105708,"featured_media":257472,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[],"class_list":["post-257505","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio"],"acf":[],"blog_post_summary":"<p>Compare a historical commit with your working tree without checking out the commit or leaving your branch.<\/p>\n","_links":{"self":[{"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/257505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/105708"}],"replies":[{"embeddable":true,"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=257505"}],"version-history":[{"count":1,"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/257505\/revisions"}],"predecessor-version":[{"id":257506,"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/257505\/revisions\/257506"}],"wp:featuredmedia":[{"embeddable":true,"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/257472"}],"wp:attachment":[{"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=257505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=257505"},{"taxonomy":"post_tag","embeddable":true,"href":"/__p/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=257505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}