{"id":1056,"date":"2014-04-11T11:26:32","date_gmt":"2014-04-11T10:26:32","guid":{"rendered":"https:\/\/www.hutsky.cz\/blog\/?p=1056"},"modified":"2014-06-09T10:19:10","modified_gmt":"2014-06-09T09:19:10","slug":"git-show-all-files-modified-between-two-commits","status":"publish","type":"post","link":"https:\/\/www.hutsky.cz\/blog\/2014\/04\/git-show-all-files-modified-between-two-commits\/","title":{"rendered":"Git &#8211; show all files modified between two commits"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-1060\" alt=\"git\" src=\"https:\/\/www.hutsky.cz\/blog\/wp-content\/uploads\/git.png\" width=\"200\" height=\"84\" \/>It&#8217;s always best to commit your work only once it&#8217;s done. Sometimes the changes span over days or weeks and this is where <a href=\"http:\/\/git-scm.com\/book\/en\/Git-Tools-Stashing\">stashing<\/a> comes useful. Sometimes, however, I start work at the office and then I want to go on at home in the evening. So I commit the half-done changes to the <em>dev<\/em> branch, push it to the <em>origin<\/em> and check it out at home again. Once the work is done and ready to be deployed, I need to see what files have been modified. If there was only one commit, it would be easy, but since the work spans over several commits, I need a list of all files:<\/p>\n<pre><code>git diff --name-only SHA1 SHA2<\/code><\/pre>\n<p>SHA1 and SHA2 are the hashes of the two commits. You can get them displayed using:<\/p>\n<pre>git log<\/pre>\n<p>or to get a better format:<\/p>\n<pre>git log --graph --date-order -C -M --pretty=format:\"&lt;%h&gt; %ad [%an] %Cgreen%d%Creset %s\" --all --date=short<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s always best to commit your work only once it&#8217;s done. Sometimes the changes span over days or weeks and this is where stashing comes useful. Sometimes, however, I start work at the office and then I want to go &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.hutsky.cz\/blog\/2014\/04\/git-show-all-files-modified-between-two-commits\/\"> <span class=\"screen-reader-text\">Git &#8211; show all files modified between two commits<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-1056","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/comments?post=1056"}],"version-history":[{"count":7,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1056\/revisions"}],"predecessor-version":[{"id":1074,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1056\/revisions\/1074"}],"wp:attachment":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/media?parent=1056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/categories?post=1056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/tags?post=1056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}