{"thread":{"id":"29956","subject":"How to git diff files in renamed directories","startedAt":"2012-03-15T08:32:54Z","lastAt":"2012-03-15T20:49:35Z","messageCount":4,"participants":["Patrick Sabin","Damien Wyart","Neal Kreitzinger","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"187030","messageId":"CAGATVH7KCr+dJNpx18==3BT8pzsvKeV5aYRWKts7xH0YZ8yaKw@mail.gmail.com","threadId":"29956","inReplyTo":null,"subject":"How to git diff files in renamed directories","fromName":"Patrick Sabin","fromEmail":"patrick.just4fun@gmail.com","sentAt":"2012-03-15T08:32:54Z","receivedAt":"2012-03-15T08:32:54Z","isPatch":false,"sender":{"key":"patrick.just4fun@gmail.com","avatar":null},"body":"Hi,\n\nI want to diff a renamed file (to a different directory) in different commits.\n\nFile a was moved to the file subdir/c\n\nI tried:\n\n$ git diff b616d 0aa0 -- subdir/c a\n\nbut git seems to always diff against /dev/null:\n\ndiff --git a/a b/a\nnew file mode 100644\nindex 0000000..2e5ada8\n--- /dev/null\n+++ b/a\n@@ -0,0 +1 @@\n+File a\ndiff --git a/subdir/c b/subdir/c\ndeleted file mode 100644\nindex 24c846c..0000000\n--- a/subdir/c\n+++ /dev/null\n@@ -1,2 +0,0 @@\n-File b\n-Another b change.\n\ngit log --follow subdir/c   recognizes that the file has been renamed\nand moved to subdirectory.\n\nIs there any way to get such a diff in git?\n\nRegards,\nPatrick\n"},{"id":"187035","messageId":"20120315085105.GA27243@brouette","threadId":"29956","inReplyTo":"CAGATVH7KCr+dJNpx18==3BT8pzsvKeV5aYRWKts7xH0YZ8yaKw@mail.gmail.com","subject":"Re: How to git diff files in renamed directories","fromName":"Damien Wyart","fromEmail":"damien.wyart@gmail.com","sentAt":"2012-03-15T08:51:05Z","receivedAt":"2012-03-15T08:51:05Z","isPatch":false,"sender":{"key":"damien.wyart@gmail.com","avatar":null},"body":"Hi,\n\n* Patrick Sabin <patrick.just4fun@gmail.com> [2012-03-15 09:32]:\n> I want to diff a renamed file (to a different directory) in different\n> commits.\n\nYou can try the \"-C\" option to git diff. In some cases, \"-C -C\" might be\nneeded (with potentially bad performance).\n\n-- \nDamien\n"},{"id":"187038","messageId":"4F61C4BB.20908@gmail.com","threadId":"29956","inReplyTo":"CAGATVH7KCr+dJNpx18==3BT8pzsvKeV5aYRWKts7xH0YZ8yaKw@mail.gmail.com","subject":"Re: How to git diff files in renamed directories","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2012-03-15T10:30:19Z","receivedAt":"2012-03-15T10:30:19Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 3/15/2012 3:32 AM, Patrick Sabin wrote:\n>\n> I want to diff a renamed file (to a different directory) in different commits.\n>\n> File a was moved to the file subdir/c\n>\n> I tried:\n>\n> $ git diff b616d 0aa0 -- subdir/c a\n>\n> but git seems to always diff against /dev/null:\n>\n> diff --git a/a b/a\n> new file mode 100644\n> index 0000000..2e5ada8\n> --- /dev/null\n> +++ b/a\n> @@ -0,0 +1 @@\n> +File a\n> diff --git a/subdir/c b/subdir/c\n> deleted file mode 100644\n> index 24c846c..0000000\n> --- a/subdir/c\n> +++ /dev/null\n> @@ -1,2 +0,0 @@\n> -File b\n> -Another b change.\n>\n> git log --follow subdir/c   recognizes that the file has been renamed\n> and moved to subdirectory.\n>\n> Is there any way to get such a diff in git?\n>\ngit diff b616d:a 0aa0:subdir/c is one way to do it.\n\nv/r,\nneal\n"},{"id":"187055","messageId":"7vbonxk2sg.fsf@alter.siamese.dyndns.org","threadId":"29956","inReplyTo":"CAGATVH7KCr+dJNpx18==3BT8pzsvKeV5aYRWKts7xH0YZ8yaKw@mail.gmail.com","subject":"Re: How to git diff files in renamed directories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-15T20:49:35Z","receivedAt":"2012-03-15T20:49:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Sabin <patrick.just4fun@gmail.com> writes:\n\n> I want to diff a renamed file (to a different directory) in different commits.\n>\n> File a was moved to the file subdir/c\n>\n> I tried:\n>\n> $ git diff b616d 0aa0 -- subdir/c a\n\nDoes\n\n    $ git diff -M b616d 0aa0 -- subdir/c a\n\nmatch them up?    \n"}]}