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

git-diff-tree rename detection for single file

From
David Ho <davidkwho@gmail.com>
Date
Oct 18, 2005, 19:56 UTC
Message-ID
<4dd15d180510181256i1c5a82d9ld62acaedb493cf71@mail.gmail.com>
Hi,

I have a small suggestion to make the diff of a renamed file a bit more meaningful. I have a file that is renamed-edited and commited. git-diff-tree -M -p <commit> shows one result and git-diff-tree -M -p <commit> <filename> shows another. If they both show a rename occurred then I think the single file git-diff-tree will be more useful.

Any strange idea I have is to make git-diff-tree traverse the list of commits (assuming the list is returned from git-rev-list) to trace renames of the file to its origin. Of course I don't know how useful this is to most.

David

[davidho@penguin git-tutorial]$ git-diff-tree -r -M -p \ 8c77fe87790276b4e0b2650d7c5799eb893ac3ed 8c77fe87790276b4e0b2650d7c5799eb893ac3ed

diff --git a/goodbye b/ciao
similarity index 83%
rename from goodbye
rename to ciao
index 0561cce..d8259f5 100644
--- a/goodbye
+++ b/ciao
@@ -4,3 +4,4 @@ Play, play, play
 Work, work, work
 Eat, eat, eat
 Drink, drink, drink
+Chew, chew, chew


[davidho@penguin git-tutorial]$ git-diff-tree -r -M -p \
8c77fe87790276b4e0b2650d7c5799eb893ac3ed ciao
8c77fe87790276b4e0b2650d7c5799eb893ac3ed
diff --git a/ciao b/ciao
new file mode 100644
index 0000000..d8259f5
--- /dev/null
+++ b/ciao
@@ -0,0 +1,7 @@
+Hello World
+It's a new day for git
+Play, play, play
+Work, work, work
+Eat, eat, eat
+Drink, drink, drink
+Chew, chew, chew
Next: Junio C Hamano
Message 1 of 6 in “git-diff-tree rename detection for single file”
  1. David HoOct 18, 2005
  2. Junio C HamanoOct 18, 2005
  3. Junio C HamanoOct 19, 2005
  4. Linus TorvaldsOct 19, 2005
  5. Junio C HamanoOct 19, 2005
  6. Nicolas PitreOct 19, 2005

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.