git/list[1] front-page[2] threads[3] people[4] search[5] about
 

How to git diff files in renamed directories

From
PSPatrick Sabin <patrick.just4fun@gmail.com>
Date
Mar 15, 2012, 08:32 UTC
Message-ID
<CAGATVH7KCr+dJNpx18==3BT8pzsvKeV5aYRWKts7xH0YZ8yaKw@mail.gmail.com>
Hi,
I want to diff a renamed file (to a different directory) in different commits.
File a was moved to the file subdir/c
I tried:
$ git diff b616d 0aa0 -- subdir/c a
but git seems to always diff against /dev/null:
diff --git a/a b/a
new file mode 100644
index 0000000..2e5ada8
--- /dev/null
+++ b/a
@@ -0,0 +1 @@
+File a
diff --git a/subdir/c b/subdir/c
deleted file mode 100644
index 24c846c..0000000
--- a/subdir/c
+++ /dev/null
@@ -1,2 +0,0 @@
-File b
-Another b change.

git log --follow subdir/c   recognizes that the file has been renamed
and moved to subdirectory.

Is there any way to get such a diff in git?

Regards,
Patrick
Next: Damien Wyart
Message 1 of 4 in “How to git diff files in renamed directories”
  1. Patrick SabinMar 15, 2012
  2. Damien WyartMar 15, 2012
  3. Neal KreitzingerMar 15, 2012
  4. Junio C HamanoMar 15, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.